Bug 831276 - Deleting organization does not delete orphaned rpms
Summary: Deleting organization does not delete orphaned rpms
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Packaging
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Justin Sherrill
QA Contact: Hayk Hovsepyan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-12 16:06 UTC by Og Maciel
Modified: 2019-09-25 21:11 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-24 17:08:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Og Maciel 2012-06-12 16:06:35 UTC
Description of problem:

This is a regression. Deleting an existing organization that has content in pulp does not delete the corresponding repositories from the file system.

Version-Release number of selected component (if applicable):

* candlepin-0.6.5-1.el6_2.noarch
* candlepin-tomcat6-0.6.5-1.el6_2.noarch
* katello-0.1.313-1.el6_3.noarch
* katello-all-0.1.313-1.el6_3.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.0.7-1.el6_3.noarch
* katello-cli-0.1.108-1.el6_3.noarch
* katello-cli-common-0.1.108-1.el6_3.noarch
* katello-common-0.1.313-1.el6_3.noarch
* katello-configure-0.1.109-1.el6_3.noarch
* katello-glue-candlepin-0.1.313-1.el6_3.noarch
* katello-glue-foreman-0.1.313-1.el6_3.noarch
* katello-glue-pulp-0.1.313-1.el6_3.noarch
* katello-qpid-broker-key-pair-1.0-1.noarch
* katello-qpid-client-key-pair-1.0-1.noarch
* katello-selinux-0.1.10-1.el6.noarch
* pulp-1.0.4-1.el6.noarch
* pulp-admin-1.0.4-1.el6.noarch
* pulp-client-lib-1.0.4-1.el6.noarch
* pulp-common-1.0.4-1.el6.noarch
* pulp-selinux-server-1.0.4-1.el6.noarch

How reproducible:


Steps to Reproduce:
1. Create an organization Paris with the default Dev environment
2. Either add a custom repository or upload a manifest file
3. Synchronize the content
4. Try to delete the organization
  
Actual results:

The web ui (and katello-jobs) indicate that the organization was properly deleted, but the corresponding repository is still in the file system (i.e. /var/lib/pulp/repos/)

Expected results:

The repositories associated with a deleted organization should also be deleted.

Additional info:

Comment 1 Garik Khachikyan 2012-06-13 08:07:02 UTC
... but I'm really not sure if it's an issue that Katello/CFSE should take care (and most probably would not have enough rights to modify /var/lib/pulp/ there)

And I would not recommend us doing that - one should take care also about ks structure, packages, etc. Also as far as i know pulp prepares symlinks in case if it could find a syncing content already stored. So hard-removing the repo and the stuff would not be the right thing we would wish to do.

I would consider to open this topic for #pulp guys first. thanks.

Comment 4 Justin Sherrill 2012-06-19 14:39:14 UTC
I was not able to reproduce this on System engine 1.0.0, both the repo object from pulp and the repo directory were deleted.  gonna test on 1.0.1

Comment 5 Justin Sherrill 2012-06-19 15:06:09 UTC
I'm not able to reproduce this on 1.0.1 either.  In all cases i wait until the delayed jobs log shows the org deletion occur and then check both pulp-admin and /var/lib/pulp/repos  and everything is gone.  Tried with both a non-promoted and promoted repo.  Og, are you able to reproduce?

Comment 6 Og Maciel 2012-06-19 17:47:40 UTC
Seems that the original issue (left over repository folders in the file system) only happen if you have RHEL content. Custom content is properly/completely deleted from /var/lib/pulp/repos/.

Comment 7 Justin Sherrill 2012-08-30 12:53:47 UTC
Trying to reproduce this again and I do not see any issue.  I followed these steps:


1.  Create an org
2.  Upload manifest
3.  Sync a red hat repo with a distro
4.  Promoted repo
5.  Deleted organization. 

results:

after waiting 5-10 minutes /var/lib/pulp/repos/ is completely empty.  Og, can you retest?

Comment 8 Og Maciel 2012-08-30 15:33:15 UTC
Ok, so the issue at hand here is that, as far as the web ui user knows, the Org and all of its resources are deleted but in truth things won't be removed immediately... it is a scheduled task, and sure enough, after waiting for a few minutes, everything was properly deleted.

So, feel free to close this but I'd argue that the ui should make it clear to the user that things are still scheduled for deletion. Nothing stops the user from trying to re-create the same org immediately after deleting it, and that is when things can break.

Comment 9 Justin Sherrill 2012-08-30 15:35:28 UTC
Og, agreed!  Feel free to open another bz requesting that to be made more apparent.

-Justin

Comment 10 Mike McCune 2013-05-30 15:19:49 UTC
With Pulp V2 this is back again.  We need to make calls to delete orphans after deleting an Org otherwise the packages will not get deleted off disk.

see:

https://pulp-dev-guide.readthedocs.org/en/pulp-2.1/integration/rest-api/content/orphan.html

we need to do one of the following:

1) make a call after each repo delete to:

DELETE /pulp/api/v2/content/orphans/

which is a global operation

2) have a background job that periodically calls 

DELETE /pulp/api/v2/content/orphans/

this seems kinda hacky

3) work with pulp to enhance their repo delete routine to support deleting orphans as they go along deleting the repo.

Comment 12 Justin Sherrill 2013-06-03 20:24:33 UTC
@mmccune   is this bug really 'back' in that the repos themselves hang around, or is it just that the rpms hang around on disk?

Note that this bug wasn't ever really a bug, and never had a fix.

Comment 13 Garik Khachikyan 2013-06-04 08:35:25 UTC
and please: one would be really disappointed if there would be removal of rpms physically from the disk if there would exists any other org sharing them (having a link).

Comment 15 Mike McCune 2013-07-12 03:59:01 UTC
WORKAROUND:

once you delete all the repos you can run this API call from the command line on the Katello server:


 curl -X DELETE -k -u "admin:<password>" https://localhost/pulp/api/v2/content/orphans/

password can be found in /etc/pulp/server.conf:

# default_password: (plaintext password) default password for admin
default_password: <password>

you could put this in a daily cron job if you want to just clean out the orphaned packages every so often.

Comment 16 Mike McCune 2013-08-16 17:54:33 UTC
getting rid of 6.0.0 version since that doesn't exist

Comment 17 Justin Sherrill 2013-09-13 19:50:10 UTC
Working on this

Comment 18 Justin Sherrill 2013-09-13 20:31:21 UTC
Opened PRs for weekly orphaned content deletion.

https://github.com/Katello/katello/pull/2946
https://github.com/Katello/runcible/pull/108

Comment 21 Hayk Hovsepyan 2013-10-14 13:01:18 UTC
Tested on revision:
signo-0.0.22-2.el6sat.noarch
Katello-Katello-Installation-RegisterRHNClassic-1.1-4.noarch
foreman-1.3.0-15.el6sat.noarch
katello-cli-common-1.4.3-19.el6sat.noarch
openldap-2.4.23-31.el6.x86_64
pulp-nodes-common-2.3.0-0.17.beta.el6sat.noarch
candlepin-scl-quartz-2.1.5-5.el6_4.noarch
candlepin-0.8.25-1.el6sam.noarch
elasticsearch-0.19.9-8.el6sat.noarch
katello-glue-pulp-1.4.6-29.el6sat.noarch
katello-qpid-client-key-pair-1.0-1.noarch
katello-agent-1.4.4-3.el6sat.noarch
Katello-Katello-Installation-Satellite6Latest-1.0-12.noarch
candlepin-scl-runtime-1-5.el6_4.noarch
apr-util-ldap-1.3.9-3.el6_0.1.x86_64
katello-qpid-broker-key-pair-1.0-1.noarch
foreman-proxy-1.3.0-3.el6sat.noarch
foreman-postgresql-1.3.0-15.el6sat.noarch
katello-cli-1.4.3-19.el6sat.noarch
pulp-selinux-2.3.0-0.17.beta.el6sat.noarch
python-ldap-2.3.10-1.el6.x86_64
katello-certs-tools-1.4.4-1.el6sat.noarch
katello-configure-foreman-proxy-1.4.5-10.el6sat.noarch
pulp-rpm-plugins-2.3.0-0.17.beta.el6sat.noarch
pulp-nodes-parent-2.3.0-0.17.beta.el6sat.noarch
pulp-katello-plugins-0.2-1.el6sat.noarch
ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
candlepin-scl-1-5.el6_4.noarch
candlepin-tomcat6-0.8.25-1.el6sam.noarch
signo-katello-0.0.22-2.el6sat.noarch
katello-glue-candlepin-1.4.6-29.el6sat.noarch
katello-selinux-1.4.4-4.el6sat.noarch
katello-1.4.6-29.el6sat.noarch
ruby193-rubygem-ldap_fluff-0.2.2-2.el6sat.noarch
katello-configure-foreman-1.4.5-10.el6sat.noarch
katello-foreman-all-1.4.6-29.el6sat.noarch
Katello-Katello-Configuration-KatelloClient-1.1-53.noarch
candlepin-cert-consumer-ares.usersys.redhat.com-1.0-1.noarch
katello-repos-1.4.2-1.el6.noarch
candlepin-scl-rhino-1.7R3-1.el6_4.noarch
katello-configure-1.4.5-10.el6sat.noarch
pulp-server-2.3.0-0.17.beta.el6sat.noarch
pulp-puppet-plugins-2.3.0-0.17.beta.el6sat.noarch
candlepin-selinux-0.8.25-1.el6sam.noarch
katello-common-1.4.6-29.el6sat.noarch
katello-glue-elasticsearch-1.4.6-29.el6sat.noarch
katello-all-1.4.6-29.el6sat.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
pulp-rpm-handlers-2.3.0-0.17.beta.el6sat.noarch
Katello-Katello-Installation-HammerCLI-1.0-7.noarch
Katello-Katello-Sanity-ImportKeys-1.2-1.noarch

Steps:
1. Create org.
2. Create custom provider/product/repo (zoo), sync repo. Check that "zoo" repo content is in "/var/lib/pulp/content/rpm/".
3. Run katello-configure command with additional "--reset-cache=YES --reset-data=YES" options to reset database. Check that only default org is there.
4. Force run remove orphans job over weekend: "/etc/cron.weekly/katello-remove-orphans"
5. I have checked content of "/var/lib/pulp/content/rpm/" and zoo repo content is still there.

Comment 22 Justin Sherrill 2013-10-14 18:56:20 UTC
Hey Hayk,

I don't think you were properly testing this bug.  It is not meant to delete orphaned packages across runs of katello-configure --reset-data=YES, it is meant to delete orphaned packages after a user deletes a repository.

Correct Steps:

1. Create Org
2. Create custom provider/product/repo (zoo), sync repo. Check that "zoo" repo content is in "/var/lib/pulp/content/rpm/".
3. Delete 'zoo' repo
4. Wait for weekly job or force a run, check "/var/lib/pulp/content/rpm/" again for rpms


I just tested this and it worked as expected, please retest :)


I did note that the directories under /var/lib/pulp/content/rpm still existed afterwards, but the rpms themselves did not.  Opened a pulp bugzilla about that:  https://bugzilla.redhat.com/show_bug.cgi?id=1018949

This isn't a huge deal, as the directories themselves take up very little room.

Comment 23 Hayk Hovsepyan 2013-10-15 12:36:48 UTC
Thanks for clarification.

Verified on revision:
Katello-Katello-Installation-RegisterRHNClassic-1.1-4.noarch
foreman-1.3.0-17.el6sat.noarch
katello-cli-1.4.3-20.el6sat.noarch
pulp-selinux-2.3.0-0.17.beta.el6sat.noarch
openldap-2.4.23-31.el6.x86_64
apr-util-ldap-1.3.9-3.el6_0.1.x86_64
python-ldap-2.3.10-1.el6.x86_64
katello-certs-tools-1.4.4-1.el6sat.noarch
pulp-nodes-parent-2.3.0-0.17.beta.el6sat.noarch
elasticsearch-0.19.9-8.el6sat.noarch
katello-glue-candlepin-1.4.6-31.el6sat.noarch
candlepin-tomcat6-0.8.25-1.el6sam.noarch
katello-repos-1.5.1-1.el6.noarch
katello-agent-1.5.1-1.el6.noarch
Katello-Katello-Installation-Satellite6Latest-1.0-12.noarch
candlepin-scl-rhino-1.7R3-1.el6_4.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-qpid-client-key-pair-1.0-1.noarch
candlepin-cert-consumer-poseidon.usersys.redhat.com-1.0-1.noarch
signo-0.0.22-2.el6sat.noarch
foreman-proxy-1.3.0-3.el6sat.noarch
foreman-postgresql-1.3.0-17.el6sat.noarch
katello-cli-common-1.4.3-20.el6sat.noarch
katello-configure-1.4.7-3.el6sat.noarch
pulp-server-2.3.0-0.17.beta.el6sat.noarch
pulp-nodes-common-2.3.0-0.17.beta.el6sat.noarch
pulp-puppet-plugins-2.3.0-0.17.beta.el6sat.noarch
candlepin-scl-1-5.el6_4.noarch
ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
candlepin-selinux-0.8.25-1.el6sam.noarch
signo-katello-0.0.22-2.el6sat.noarch
katello-selinux-1.4.4-4.el6sat.noarch
katello-glue-elasticsearch-1.4.6-31.el6sat.noarch
katello-1.4.6-31.el6sat.noarch
katello-configure-foreman-1.4.7-3.el6sat.noarch
katello-all-1.4.6-31.el6sat.noarch
pulp-rpm-handlers-2.3.0-0.17.beta.el6sat.noarch
Katello-Katello-Installation-HammerCLI-1.0-8.noarch
candlepin-scl-runtime-1-5.el6_4.noarch
katello-configure-foreman-proxy-1.4.7-3.el6sat.noarch
pulp-rpm-plugins-2.3.0-0.17.beta.el6sat.noarch
pulp-katello-plugins-0.2-1.el6sat.noarch
candlepin-scl-quartz-2.1.5-5.el6_4.noarch
candlepin-0.8.25-1.el6sam.noarch
katello-common-1.4.6-31.el6sat.noarch
katello-glue-pulp-1.4.6-31.el6sat.noarch
katello-foreman-all-1.4.6-31.el6sat.noarch
ruby193-rubygem-ldap_fluff-0.2.2-2.el6sat.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
Katello-Katello-Configuration-KatelloClient-1.1-53.noarch
Katello-Katello-Sanity-ImportKeys-1.2-1.noarch

Comment 26 Bryan Kearney 2014-04-24 17:08:43 UTC
This was verified and delivered with MDP2. Closing it out.


Note You need to log in before you can comment on or make changes to this bug.