Issue #769
Updated by dkliban@redhat.com over 9 years ago
When using the Install Distributor to publish puppet modules the following traceback appears in logs: <pre> 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'. </pre> 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 the operation continue. To make this happen using pic, I did the following: 1. Download the module attached to this issue. 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 <pre> 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"}) </pre>