Bug 1148395

Summary: Hammer : Uploading content to repository allows to upload text file whereas it should allow only rpms to upload
Product: Red Hat Satellite Reporter: Tazim Kolhar <tkolhar>
Component: HammerAssignee: David Davis <daviddavis>
Status: CLOSED ERRATA QA Contact: Sanket Jagtap <sjagtap>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.6CC: bbuckingham, bmbouter, brubisch, cwelton, daviddavis, dkliban, ggainey, ipanova, kbidarka, ktordeur, mhrivnak, pcreech, rchan, sghai, sjagtap, sreber, ttereshc
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
URL: https://pulp.plan.io/issues/1747
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:49:54 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 Tazim Kolhar 2014-10-01 11:41:01 UTC
Description of problem:
Hammer : Uploading content to repository allows to upload text file whereas it should allow only rpms to upload

Version-Release number of selected component (if applicable):
# rpm -qa | grep foreman
ruby193-rubygem-foreman-tasks-0.6.9-1.1.el6sat.noarch
foreman-compute-1.6.0.44-1.el6sat.noarch
ruby193-rubygem-foreman_hooks-0.3.5-2.el6sat.noarch
foreman-postgresql-1.6.0.44-1.el6sat.noarch
foreman-1.6.0.44-1.el6sat.noarch
foreman-vmware-1.6.0.44-1.el6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.0.4-1.el6sat.noarch
rubygem-hammer_cli_foreman-0.1.1-16.el6sat.noarch
cloud-qe-10.idmqe.lab.eng.bos.redhat.com-foreman-proxy-1.0-1.noarch
foreman-selinux-1.6.0.14-1.el6sat.noarch
foreman-gce-1.6.0.44-1.el6sat.noarch
ruby193-rubygem-foreman_bootdisk-2.0.6-1.1.el6sat.noarch
cloud-qe-10.idmqe.lab.eng.bos.redhat.com-foreman-client-1.0-1.noarch
foreman-ovirt-1.6.0.44-1.el6sat.noarch
ruby193-rubygem-foreman_discovery-1.3.0-2.el6sat.noarch
foreman-proxy-1.6.0.30-1.el6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3-3.el6sat.noarch
foreman-libvirt-1.6.0.44-1.el6sat.noarch


How reproducible:
everytime

Steps to Reproduce:

# hammer -v -u admin -p ***  --output csv organization create --name='Rewuql'
Message,Id,Name
Organization created,295,Rewuql



# hammer -v -u admin -p ***  --output csv product create --description='rpczaqPvmgXHRuFsPKBb' --label='WTvTStfTpEbnbnRFjcqD' --organization-id='295' --name='pPGECyrDRMbYRUywnLFq'

Message,Id,Name
Product created,1258,pPGECyrDRMbYRUywnLFq

# hammer -v -u admin -p ***  product info --id='1258' --organization-id='295'

ID:           1258
Name:         pPGECyrDRMbYRUywnLFq
Label:        WTvTStfTpEbnbnRFjcqD
Description:  rpczaqPvmgXHRuFsPKBb
Sync State:   not_synced
Sync Plan ID: 
GPG:          
    GPG Key ID: 
    GPG Key:
Organization: Rewuql
Readonly:     false
Deletable:    
Content:

# hammer -v -u admin -p *****  --output csv repository create --product-id='1258' --name='JWlmECsxUDxBBFn' --publish-via-http='true' --url='http://inecas.fedorapeople.org/fakerepos/zoo3/' --content-type='yum'

Message,Id,Name
Repository created,91,JWlmECsxUDxBBFn


# hammer -v -u admin -p ***  --output csv repository upload-content --path='/tmp/LgrwMkSUAVmCKMl' --product-id='1258' --name='JWlmECsxUDxBBFn' --organization='Rewuql'

Message
Successfully uploaded file 'LgrwMkSUAVmCKMl'.

Actual results:
the file is text file . still it gets uploaded

Expected results:
it should allow to upload normal text files

Additional info:

Comment 1 RHEL Program Management 2014-10-01 11:43:08 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Tazim Kolhar 2014-10-01 11:47:45 UTC
Excpected result

it should not allow to upload normal text files

Comment 4 David Davis 2015-04-09 17:14:51 UTC
I think this applies to the UI as well.

Comment 5 David Davis 2016-03-04 20:00:14 UTC
Created a pulp bug to deal with the problem:

https://pulp.plan.io/issues/1747

Going to look into adding a workaround in Katello as I am not sure this fix will be added to pulp 2.8.

Comment 6 David Davis 2016-03-09 16:54:17 UTC
It sounds like this might be a regression so maybe this'll be fixed in 2.8?

Comment 8 David Davis 2016-09-06 14:08:36 UTC
Confirmed as fixed:

$ hammer repository upload-content --id 2 --path test.txt
Failed to upload file 'test.txt' to repository. Please check the file and try again.

Comment 9 pulp-infra@redhat.com 2016-09-06 16:01:24 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 10 pulp-infra@redhat.com 2016-09-06 16:01:27 UTC
The Pulp upstream bug priority is at High. Updating the external tracker on this bug.

Comment 11 David Davis 2016-09-14 19:23:31 UTC
The pulp change fixes the issue. However, we need two upstream changes to deal with this fix in pulp:

foreman-tasks

https://github.com/theforeman/foreman-tasks/pull/199

katello

https://github.com/Katello/katello/pull/6298

Comment 14 Sanket Jagtap 2016-11-15 08:34:53 UTC
Build: Satellite 6.3 Snap 6

Verified


hammer -u admin -p changeme --output csv repository upload-content --path='/tmp/apple' --product-id='23' --name='JWlmECsxUDxBBFn' --organization='Rewuql'
Message
Failed to upload file 'apple' to repository. Please check the file and try again.

Comment 17 Satellite Program 2018-02-21 16:49:54 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:0336