Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1505397 - Uploading an invalid rpm should show better error message
Summary: Uploading an invalid rpm should show better error message
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Pulp
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.4.0
Assignee: satellite6-bugs
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-23 13:51 UTC by Nikhil Kathole
Modified: 2021-04-06 17:48 UTC (History)
17 users (show)

Fixed In Version: pulp-rpm-2.16.4.1-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 19:26:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
error gif (590.93 KB, image/gif)
2018-06-14 17:15 UTC, jcallaha
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 3090 0 High CLOSED - CURRENTRELEASE Uploading an invalid rpm produces an error message: "unexpected error occurred importing uploaded file: 'primary'" 2019-03-12 18:02:36 UTC
Pulp Redmine 3901 0 Normal CLOSED - CURRENTRELEASE Improve upload error message when RPM is invalid 2018-09-18 18:31:52 UTC

Description Nikhil Kathole 2017-10-23 13:51:51 UTC
Description of problem: According to https://bugzilla.redhat.com/show_bug.cgi?id=1487903#c9 , creating new bug for better error message while uploading invalid rpm in repositories.


Version-Release number of selected component (if applicable): sat 6.3 snap 21


How reproducible: always


Steps to Reproduce:
1. Create a product
2. Create a repository
3. Try to upload any invalid file(text file,image)
4. It shows error which is valid but production.log shows 500ISE.
       tail -f /var/log/foreman/production.log

Actual results:
While uploading invalid file, 500 internal server error in production.log and notification shows "Error during upload : Task :Katello:Errors::PulpError:The importer indicated failed response when uploading".


Expected results: Error in log should handle and UI should show proper message.


Additional info:

Comment 3 pulp-infra@redhat.com 2017-10-23 15:31:58 UTC
The Pulp upstream bug status is at NEW. Updating the external tracker on this bug.

Comment 4 pulp-infra@redhat.com 2017-10-23 15:32:01 UTC
The Pulp upstream bug priority is at High. Updating the external tracker on this bug.

Comment 5 pulp-infra@redhat.com 2017-10-30 19:32:29 UTC
The Pulp upstream bug status is at ASSIGNED. Updating the external tracker on this bug.

Comment 6 pulp-infra@redhat.com 2017-10-31 21:32:03 UTC
The Pulp upstream bug status is at POST. Updating the external tracker on this bug.

Comment 7 pulp-infra@redhat.com 2017-11-14 03:32:00 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 8 pulp-infra@redhat.com 2017-11-14 04:02:02 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 9 pulp-infra@redhat.com 2017-11-17 13:32:03 UTC
The Pulp upstream bug status is at ON_QA. Updating the external tracker on this bug.

Comment 10 jcallaha 2018-06-14 17:15:27 UTC
Failed QA in Satellite 6.4 Snap 7.

There continues to be a non-helpful error message presented when upload invalid files to a rpm repo:

Error during upload: Task bd2d23e7-ec06-4503-8791-b4586ed8f852: Katello::Errors::PulpError: RPM1016: Error reading uploaded package header.

See attached gif

Comment 11 jcallaha 2018-06-14 17:15:56 UTC
Created attachment 1451480 [details]
error gif

Comment 12 pulp-infra@redhat.com 2018-06-14 17:44:40 UTC
Requesting needsinfo from upstream developer jortel because the 'FailedQA' flag is set.

Comment 13 Brad Buckingham 2018-06-25 20:07:49 UTC
Based upon the error reported, going to move this to the pulp component.

Pasting below the pulp_task output from dynflow console:

pulp_tasks:
- exception: 
  task_type: pulp.server.managers.content.upload.import_uploaded_unit
  _href: "/pulp/api/v2/tasks/537fefc1-a979-4520-903c-c4a151318ec6/"
  task_id: 537fefc1-a979-4520-903c-c4a151318ec6
  tags:
  - pulp:repository:720db840-4bd4-4276-9ad2-73a78ccb6298
  - pulp:action:import_upload
  finish_time: '2018-06-25T20:05:09Z'
  _ns: task_status
  start_time: '2018-06-25T20:05:09Z'
  traceback: |
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 367, in trace_task
        R = retval = fun(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 529, in __call__
        return super(Task, self).__call__(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 107, in __call__
        return super(PulpTask, self).__call__(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 622, in __protected_call__
        return self.run(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/pulp/server/managers/content/upload.py", line 218, in import_uploaded_unit
        unit_metadata, file_path, conduit, call_config)
      File "/usr/lib/python2.7/site-packages/pulp_rpm/plugins/importers/yum/importer.py", line 63, in upload_unit
        return upload.upload(repo, type_id, unit_key, metadata, file_path, conduit, config)
      File "/usr/lib/python2.7/site-packages/pulp_rpm/plugins/importers/yum/upload.py", line 120, in upload
        handlers[type_id](repo, type_id, unit_key, metadata, file_path, conduit, config)
      File "/usr/lib/python2.7/site-packages/pulp_rpm/plugins/importers/yum/upload.py", line 384, in _handle_package
        raise PulpCodedException(error_codes.RPM1016)
    PulpCodedException: Error reading uploaded package header.
  spawned_tasks: []
  progress_report: {}
  queue: reserved_resource_worker-0.example.com.dq2
  state: error
  worker_name: reserved_resource_worker-0.example.com
  result: 
  error:
    code: RPM1016
    data: {}
    description: Error reading uploaded package header.
    sub_errors: []
  _id:
    "$oid": 5b314af5f533b23c09b69232
  id: 5b314af5f533b23c09b69232
poll_attempts:
  total: 1
  failed: 1

Comment 14 Tanya Tereshchenko 2018-06-26 20:11:55 UTC
Could you clarify what would be a helpful message?
Headers are not correct - maybe it's not rpm at all, maybe file is just corrupted.

Thanks!

Comment 15 pulp-infra@redhat.com 2018-06-26 20:12:07 UTC
Requesting needsinfo from upstream developer jortel because the 'FailedQA' flag is set.

Comment 16 jcallaha 2018-06-27 14:22:09 UTC
Tanya, a better message could be something general like:
"Invalid RPM"

Or maybe something more specific like:
"Invalid content: Expected RPM; received Python script, ASCII text executable"

Comment 17 pulp-infra@redhat.com 2018-06-27 14:56:54 UTC
Requesting needsinfo from upstream developer jortel because the 'FailedQA' flag is set.

Comment 18 pulp-infra@redhat.com 2018-06-28 20:36:34 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 19 Tanya Tereshchenko 2018-07-02 16:39:40 UTC
Here is an additional commit which addresses the suggestion from comment#16.
https://github.com/pulp/pulp_rpm/commit/f3e618b5eb0a2195ce5b31f37fe7f5ddc120bd8f

It's a part of 3090 and it will be released in Pulp > 2.16.3.

Comment 21 Jameer Pathan 2018-08-06 10:37:29 UTC
Failed QA in Satellite 6.4 Snap 16.

Still continues to show a non-helpful error message presented when upload invalid files to a rpm repo:

Error during upload: Task 8c5db9d9-b802-4892-b1ee-a7cadffa0671: Katello::Errors::PulpError: RPM1016: Error reading uploaded package header.

does not shows error message according to commit from comment#19.

$rpm -qa pulp-server
pulp-server-2.16.3-1.el7sat.noarch

Comment 22 pulp-infra@redhat.com 2018-08-06 11:05:13 UTC
Requesting needsinfo from upstream developer jortel because the 'FailedQA' flag is set.

Comment 23 Tanya Tereshchenko 2018-08-06 16:43:28 UTC
The commit for this change hasn't been released upstream (investigating why).
So it should be cherry-picked to end up in 6.4.0 and for this BZ to be verified.

https://github.com/pulp/pulp_rpm/commit/f3e618b5eb0a2195ce5b31f37fe7f5ddc120bd8f

Comment 24 pulp-infra@redhat.com 2018-08-06 17:04:14 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 25 pulp-infra@redhat.com 2018-08-06 17:04:18 UTC
The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug.

Comment 27 Jameer Pathan 2018-08-28 07:59:09 UTC
needinfo

UI is showing proper error message while uploading invalid file but the log still shows "500 Internal Server Error", is it ok if the log shows such message.

Comment 28 Jameer Pathan 2018-08-28 08:07:46 UTC
pasting bellow error from production.log and attached log file too.


2018-08-28T03:44:35 [E|bac|] RPM1016: Uploaded file is not a valid RPM. (Katello::Errors::PulpError)
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.17/app/lib/actions/pulp/abstract_async_task.rb:121:in `block in external_task='
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.17/app/lib/actions/pulp/abstract_async_task.rb:119:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.17/app/lib/actions/pulp/abstract_async_task.rb:119:in `external_task='
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/action/polling.rb:98:in `poll_external_task_with_rescue'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/action/polling.rb:21:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/action/cancellable.rb:13:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.17/app/lib/actions/pulp/abstract_async_task.rb:45:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/action.rb:538:in `block (3 levels) in execute_run'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/middleware.rb:18:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/middleware.rb:31:in `run'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.0.5/lib/dynflow/middleware.rb:18:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.17/app/lib/actions/middleware/remote_action.rb:16:in `block in run'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.17/app/lib/actions/middleware/remote_action.rb:40:in `block in as_remote_user'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.17/app/models/katello/concerns/user_extensions.rb:21:in `cp_config'

Comment 30 Lukáš Hellebrandt 2018-08-29 10:11:14 UTC
Verified with Sat 6.4 snap 19.

Used reproducer from OP. Note that repo type must be "yum".

The notification now says "Error during upload: Task <ID>: Katello::Errors::PulpError: RPM1016: Uploaded file is not a valid RPM.".

production.log now contains "2018-08-29T06:07:14 [E|bac|] RPM1016: Uploaded file is not a valid RPM. (Katello::Errors::PulpError)" + traceback and "2018-08-29T06:07:15 [E|app|330ca] ForemanTasks::TaskError: Task 88aee4a5-ee1b-43b6-b1b2-08172bfed172: Katello::Errors::PulpError: RPM1016: Uploaded file is not a valid RPM." + traceback which seems correct to me.

Jameer, I can't see any 500 ISE in logs, not even in your snip.

Comment 31 pulp-infra@redhat.com 2018-09-18 18:31:53 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 33 Bryan Kearney 2018-10-16 19:26:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2927

Comment 34 pulp-infra@redhat.com 2019-03-12 18:02:37 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.


Note You need to log in before you can comment on or make changes to this bug.