Project

Profile

Help

Issue #769

closed

publishing puppet module fails when extracted directory name is same as unit key

Added by dkliban@redhat.com over 9 years ago. Updated about 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
2.6 Beta
Platform Release:
2.6.1
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

When using the Install Distributor to publish puppet modules the following traceback appears in logs:

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'.

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

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"})

Files

ssh_key.0.1.0.tar.gz (1.31 KB) ssh_key.0.1.0.tar.gz module that breaks pulp dkliban@redhat.com, 03/17/2015 03:33 PM

Also available in: Atom PDF