Project

Profile

Help

Issue #1607

Puppet install distributor fails when deleting repository if not published

Added by jsherril@redhat.com over 4 years ago. Updated over 1 year ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
Master
Platform Release:
2.8.1
OS:
CentOS 7
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

This PR: https://github.com/pulp/pulp_puppet/pull/187 seems to not handle when the directory does not exist.

If you create a repo with the puppet install distributor to it and try to delete the repo, pulp will error:

raceback (most recent call last):
 File "/usr/lib/python2.7/site-packages/pulp/server/controllers/repository.py", line 515, 

   dist_controller.delete(distributor.repo_id, distributor.distributor_id)
 File "/usr/lib/python2.7/site-packages/celery/local.py", line 167, in <lambda>
   __call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
 File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 473, in __call__
   return super(Task, self).__call__(*args, **kwargs)
 File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 103, in __call__
   return super(PulpTask, self).__call__(*args, **kwargs)
 File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_cal

   return orig(self, *args, **kwargs)
 File "/usr/lib/python2.7/site-packages/celery/app/task.py", line 420, in __call__
   return self.run(*args, **kwargs)
 File "/usr/lib/python2.7/site-packages/pulp/server/controllers/distributor.py", line 133,

   dist_instance.distributor_removed(repo.to_transfer_repo(), call_config)
 File "/usr/lib/python2.7/site-packages/pulp_puppet/plugins/distributors/installdistributo

   shutil.rmtree(destination)
 File "/usr/lib64/python2.7/shutil.py", line 239, in rmtree
   onerror(os.listdir, path, sys.exc_info())
 File "/usr/lib64/python2.7/shutil.py", line 237, in rmtree
   names = os.listdir(path)
SError: [Errno 2] No such file or directory: '/var/lib/pulp/published/puppet_katello_test'

If you first publish it, it seems to delete just fine


Related issues

Has duplicate Puppet Support - Issue #1777: Repo removal fails with "No such file or directory"CLOSED - DUPLICATE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision a172f50a View on GitHub
Added by ttereshc over 4 years ago

Stop re-raising exceptions during the removal of install_path

https://pulp.plan.io/issues/1607 closes #1607

History

#1 Updated by jsherril@redhat.com over 4 years ago

  • Subject changed from Puppet install distributor fails to Puppet install distributor fails when deleting repository if not published

#2 Updated by jortel@redhat.com over 4 years ago

  • Severity changed from 2. Medium to 3. High
  • Platform Release set to 2.8.1
  • Triaged changed from No to Yes

#3 Updated by ttereshc over 4 years ago

  • Assignee set to ttereshc

#4 Updated by ttereshc over 4 years ago

Note: The traceback above is from logs, output says that the task failed with PulpExecutionException:

$ pulp-admin puppet repo delete --repo-id puppet_repo

Task Failed

Pulp exception occurred: PulpExecutionException

[Errno 2] No such file or directory: 'your_directory_that_does_not_exist'

#5 Updated by ttereshc over 4 years ago

  • Status changed from NEW to ASSIGNED

#6 Updated by ttereshc over 4 years ago

I think it was intentionally made so that user would see if there were some issues during directory removal.
https://github.com/pulp/pulp_puppet/blob/2.8.0/pulp_puppet_plugins/pulp_puppet/plugins/distributors/installdistributor.py#L199-L205

But here is the possible downside of such approach. If everything was removed correctly except this install_path, we are in a such state, that the repository is no longer exists, everything is removed, but our task failed and tasks for unbinding consumers were not scheduled.
https://github.com/pulp/pulp/blob/2.8.0/server/pulp/server/controllers/repository.py#L523-L562

We also won't be able to repeat this repository deletion, because it actually was removed. It all looks a little confusing to me.

So maybe it is better not to re-raise exceptions for the install_path removal at all but still log it? And also even not to log the no-such-file-or-directory exception?

#7 Updated by mhrivnak over 4 years ago

I agree that it shouldn't cause the whole task to fail. Perhaps we should just log the exception at warning level, and not re-raise?

#8 Updated by ttereshc over 4 years ago

  • Status changed from ASSIGNED to POST

#9 Updated by ipanova@redhat.com over 4 years ago

  • Has duplicate Issue #1777: Repo removal fails with "No such file or directory" added

#11 Updated by ttereshc over 4 years ago

  • Status changed from POST to ASSIGNED

#12 Updated by ttereshc over 4 years ago

  • Status changed from ASSIGNED to POST

#13 Updated by ttereshc over 4 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#14 Updated by ttereshc over 4 years ago

  • Platform Release changed from 2.8.1 to 2.7.2

#15 Updated by ttereshc over 4 years ago

  • Platform Release changed from 2.7.2 to 2.8.1

#16 Updated by semyers over 4 years ago

  • Status changed from MODIFIED to 5

#17 Updated by pthomas@redhat.com over 4 years ago

  • Status changed from 5 to 6

verified
[root@ibm-x3550m3-10 ~]# rpm -qa |grep puppet
pulp-puppet-plugins-2.8.1-0.1.beta.el7.noarch
pulp-puppet-admin-extensions-2.8.1-0.1.beta.el7.noarch
python-pulp-puppet-common-2.8.1-0.1.beta.el7.noarch
[root@ibm-x3550m3-10 ~]#

[root@ibm-x3550m3-10 ~]#
[root@ibm-x3550m3-10 ~]#
[root@ibm-x3550m3-10 ~]# pulp-admin puppet repo create --repo-id puppet
Successfully created repository [puppet]

[root@ibm-x3550m3-10 ~]# ipython
Python 2.7.5 (default, Oct 11 2015, 17:47:16)
Type "copyright", "credits" or "license" for more information.

IPython 3.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]: from pulp.common import pic

In [2]: pic.connect()

In [3]: pic.POST ('/v2/repositories/puppet/distributors/', {'distributor_type_id':'puppet_install_distributor', 'distributor_id':'puppet_install_distributor', 'auto_publish': False, 'distributor_config': {'install_path':'/etc/puppet/puppet/'}})
Request Body
{
"distributor_id": "puppet_install_distributor",
"distributor_type_id": "puppet_install_distributor",
"distributor_config": {
"install_path": "/etc/puppet/puppet/"
},
"auto_publish": false
}
Response Body
{
"repo_id": "puppet",
"_href": "/pulp/api/v2/repositories/puppet/distributors/puppet_install_distributor/",
"_ns": "repo_distributors",
"last_publish": null,
"auto_publish": false,
"distributor_type_id": "puppet_install_distributor",
"scratchpad": {},
"_id": {
"$oid": "56f99f550e8c234e92ebcafe"
},
"config": {
"install_path": "/etc/puppet/puppet/"
},
"id": "puppet_install_distributor"
}
Out[3]:
(201,
{u'_href': u'/pulp/api/v2/repositories/puppet/distributors/puppet_install_distributor/',
u'_id': {u'$oid': u'56f99f550e8c234e92ebcafe'},
u'_ns': u'repo_distributors',
u'auto_publish': False,
u'config': {u'install_path': u'/etc/puppet/puppet/'},
u'distributor_type_id': u'puppet_install_distributor',
u'id': u'puppet_install_distributor',
u'last_publish': None,
u'repo_id': u'puppet',
u'scratchpad': {}})

In [4]: exit
[root@ibm-x3550m3-10 ~]#
[root@ibm-x3550m3-10 ~]#
[root@ibm-x3550m3-10 ~]# pulp-admin puppet repo delete --repo-id puppet
This command may be exited via ctrl+c without affecting the request.

[\]
Running...

Repository [puppet] successfully deleted

And the log still raises the error.

Mar 28 23:17:51 ibm-x3550m3-10.lab.eng.brq.redhat.com pulp[19804]: pulp_puppet.plugins.distributors.installdistributor:WARNING: error removing environment: [Errno 2] No such file or directory: '/etc/puppet/puppet/'

#18 Updated by semyers over 4 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#21 Updated by bmbouter over 1 year ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF