Bug 1402415

Summary: "hammer repository upload-content --path" misbehaviour if RPM upload takes longer than hammer timeout is
Product: Red Hat Satellite Reporter: Pavel Moravec <pmoravec>
Component: Hammer - ContentAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.5CC: bbuckingham, jcallaha, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-04 17:57:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Moravec 2016-12-07 13:47:55 UTC
Description of problem:
User scenario: "hammer repository upload-content --path /mnt/of/slow/device" starts to upload packages to a repo, but randomly fails with error:

Failed to upload file 'kernel-debuginfo-4.2.0-300.ec2.x86_64.rpm' to repository. Please check the file and try again.

The reason is, hammer_cli_katello/repository.rb uses for each such RPM upload:

      def import_upload_ids(ids)
        params = {:id => get_identifier,
                  :upload_ids => ids
        }
        resource.call(:import_uploads, params)
      end

The "resource.call" can timeout on hammer timeout. That timeout event is silently ignored and next RPM is attempted to be uploaded. So new foreman task is kicked while previous one is still running - while it has acquired relevant locks. So the new task fails with "Required lock is already taken by other running tasks." error and hammer just logs "Failed to upload file" error.

That is confusing for a user. Please either ignore the timeout on this call, or preferably at least print the timeout event so the user knows something wrong happened.



Version-Release number of selected component (if applicable):
tfm-rubygem-hammer_cli_katello-0.0.22.26-1.el7sat.noarch
Sat6.2.4


How reproducible:
100%


Steps to Reproduce:
1. To mimic slow package upload, artificially decrease hammer timeout by setting to /etc/hammer/cli.modules.d/foreman.yml ":request_timeout: 5"

2. Get some packages of few hundreds of MBs size (I used kernel-debuginfo) and put them to a directory (/tmp/many_rpms/ is used below)

3. Call in hammer shell:

product create --name=custom_product_with_many_repos --organization-id=1 --label=custom_product_with_many_repos

repository create --content-type=yum --download-policy=immediate --label=custom_repo_many_rpms --name=custom_repo_many_rpms --organization-id=1 --product=custom_product_with_many_repos

repository upload-content --path /tmp/many_rpms/ --product custom_product_with_many_repos --organization-id=1 --name custom_repo_many_rpms


Actual results:
Sporadic to frequent errors:

Failed to upload file 'kernel-debuginfo-4.2.0-300.ec2.x86_64.rpm' to repository. Please check the file and try again.


Expected results:
No such error, or at least preceded by timeout warning.


Additional info:

Comment 4 Bryan Kearney 2018-09-04 17:57:40 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.