Bug 1199638

Summary: Publishing a content view with a puppet module with non-ascii text fails
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED CURRENTRELEASE QA Contact: Tazim Kolhar <tkolhar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bkearney, bmbouter, cwelton, daviddavis, dkliban, ggainey, ipanova, lpramuk, mhrivnak, omaciel, pcreech, rchan, tkolhar, ttereshc
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 13:56:06 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:
Bug Depends On:    
Bug Blocks: 1167788    
Attachments:
Description Flags
puppet module in question none

Description Justin Sherrill 2015-03-06 20:26:22 UTC
Created attachment 998998 [details]
puppet module in question

Description of problem:

Publishing a content view with the attached puppet module fails.  It may have to do with non-ascii text in the module, it is unclear.

Attached the example module.  


Version-Release number of selected component (if applicable):
seen on pulp-2.5.1 and pulp-2.6.0-0.7.beta

How reproducible:
Always

Steps to Reproduce:
1. Create a puppet repo
2. Upload attached puppet module
3. Add the module to a content view
4. Attempt to publish content view

Actual results:
Fails


Expected results:
Succeeds 


Additional info:

The puppet install distributor in pulp fails with the following traceback:


Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/celery/app/trace.py",
    line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/async/tasks.py",
    line 328, in __call__
    return super(Task, self).__call__(*args, **kwargs)

     File "/usr/lib/python2.6/site-packages/celery/app/trace.py", line 437, in
    __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/managers/repo/publish.py",
    line 99, in publish
    transfer_repo, conduit, call_config)
  File "/usr/lib/python2.6/site-packages/pulp/server/managers/repo/publish.py",
    line 127, in _do_publish
    publish_report = publish_repo(transfer_repo, conduit,
    call_config)
  File "/usr/lib/python2.6/site-packages/pulp/server/async/tasks.py",
    line 483, in wrap_f
    return f(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/pulp_puppet/plugins/distributors/installdistributor.py",
    line 129, in publish_repo
    self._rename_directory(unit, temporarydestination,
    archive.getnames())
  File "/usr/lib/python2.6/site-packages/pulp_puppet/plugins/distributors/installdistributor.py",
    line 219, in _rename_directory
    shutil.move(before, after)
  File "/usr/lib64/python2.6/shutil.py",
    line 256, in move
    raise Error, "Cannot move a directory '%s' into itself
    '%s'." % (src, dst)
Error: Cannot move a directory '/etc/puppet/environments/KT_Default_Organization_Library_RHEL_70_x86_64_Content_Host_10/pulpLMQUgA/ssh_key'
    into itself '/etc/puppet/environments/KT_Default_Organization_Library_RHEL_70_x86_64_Content_Host_10/pulpLMQUgA/ssh_key'.

Comment 1 Justin Sherrill 2015-03-06 20:26:57 UTC
appears to be a pulp issue, cc'ing mhrivnak

Comment 3 Michael Hrivnak 2015-03-16 19:14:39 UTC
Dennis will investigate.

Comment 4 Dennis Kliban 2015-03-17 13:54:54 UTC
I was able to reproduce only on EL6. Once an uploaded puppet module is uploaded, Pulp extracts the contents and then renames the top level directory to match the unit key. If the top level directory already has that name, shutil.move is still called. Python 2.6 throws an exception while Python 2.7 lets this happen. 

To make this happen using pic, I did the following:

1. Download the modules attached to this bugzilla. 
2. mv ssh_key.0.1.0.tar.gz me-ssh_key-0.1.0.tar.gz
3. sudo mkdir /etc/puppet/myforges 
4. sudo chown apache:apache /etc/puppet/myforges
5. sudo semanage boolean --modify --on pulp_manage_puppet
6. pulp-admin puppet repo create --repo-id test
7. pulp-admin puppet repo uploads upload -f me-ssh_key-0.1.0.tar.gz --repo-id test
8. open interactive python interpreter and paste the following

from pulp.common import pic
pic.connect()
pic.POST('/v2/repositories/test/distributors/', {'distributor_type_id':'puppet_install_distributor', 'distributor_id':'puppet_tmp_install_distributor', 'auto_publish': False, 'distributor_config':               {'install_path':'/etc/puppet/myforges/test'}})
pic.connect()
pic.POST('/pulp/api/v2/repositories/test/actions/publish/', {'id':
"puppet_tmp_install_distributor"})

Comment 7 Dennis Kliban 2015-03-17 20:44:44 UTC
The fix has been merged upstream. 

https://github.com/pulp/pulp_puppet/pull/168

Comment 8 Brian Bouterse 2015-03-25 18:00:25 UTC
The Pulp upstream bug status is at ON_QA. Updating the external tracker on this bug.

Comment 9 Brian Bouterse 2015-03-26 17:30:21 UTC
The Pulp upstream bug status is at VERIFIED. Updating the external tracker on this bug.

Comment 10 Brian Bouterse 2015-04-29 19:29:12 UTC
Adding bbouters to cc list

Comment 12 pulp-infra@redhat.com 2015-05-05 14:00:24 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 13 Og Maciel 2015-05-11 13:53:12 UTC
Bugzilla bot changed my QA_ACK+ to QA_ACK?. Changing it back.

Comment 16 Tazim Kolhar 2015-05-14 06:52:29 UTC
VERIFIED:

# rpm -qa |grep foreman
foreman-1.7.2.21-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.4-1.el7sat.noarch
foreman-ovirt-1.7.2.21-1.el7sat.noarch
ruby193-rubygem-foreman-redhat_access-0.1.0-1.el7sat.noarch
rubygem-hammer_cli_foreman-0.1.4.11-1.el7sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.12-1.el7sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el7sat.noarch
foreman-debug-1.7.2.20-1.el7sat.noarch
foreman-selinux-1.7.2.13-1.el7sat.noarch
foreman-proxy-1.7.2.4-1.el7sat.noarch
qe-sat6-rhel71.usersys.redhat.com-foreman-proxy-client-1.0-1.noarch
foreman-libvirt-1.7.2.21-1.el7sat.noarch
foreman-postgresql-1.7.2.21-1.el7sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.13-1.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el7sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.13-1.el7sat.noarch
qe-sat6-rhel71.usersys.redhat.com-foreman-client-1.0-1.noarch
qe-sat6-rhel71.usersys.redhat.com-foreman-proxy-1.0-1.noarch
foreman-compute-1.7.2.21-1.el7sat.noarch
foreman-vmware-1.7.2.21-1.el7sat.noarch
foreman-gce-1.7.2.21-1.el7sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.6-1.el7sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el7sat.noarch
puppet-foreman_scap_client-0.3.3-8.el7sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.5-1.el7sat.noarch

steps:
1. Create a puppet repo
2. Upload attached puppet module
3. Add the module to a content view
4. Attempt to publish content view

the publish succeeded

Comment 18 Bryan Kearney 2015-08-11 13:19:52 UTC
This bug is slated to be released with Satellite 6.1.

Comment 19 Bryan Kearney 2015-08-12 13:56:06 UTC
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.