Bug 1111223 - Removing a lifecycle environment from a capsule does not cause repos to be removed from
Summary: Removing a lifecycle environment from a capsule does not cause repos to be re...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Capsule - Content
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
high
medium vote
Target Milestone: 6.6.0
Assignee: Justin Sherrill
QA Contact: Lukas Pramuk
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1269163 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-19 13:51 UTC by Justin Sherrill
Modified: 2019-12-16 04:30 UTC (History)
21 users (show)

Fixed In Version: rubygem-katello-3.12.0.24-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-22 12:46:40 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 6288 Normal Rejected Removing a lifecycle environment from a capsule does not cause repos to be removed from 2020-01-17 14:00:01 UTC
Foreman Issue Tracker 27795 Normal Closed orphan cleanup on capsule doesn't delete uneeded repos 2020-01-17 13:59:59 UTC
Red Hat Knowledge Base (Solution) 2639291 None None None 2016-09-19 10:57:04 UTC
Red Hat Product Errata RHSA-2019:3172 None None None 2019-10-22 12:47:01 UTC

Description Justin Sherrill 2014-06-19 13:51:08 UTC
Right now if you:

Create a capsule
Associate it with a lifecycle environment (one that has content)
Sync the capsule
Unassociate it with the lifecycle environment

You would expect all content on the capsule to be removed immediately, instead you have to manually 'sync' the capsule again.

Comment 1 Justin Sherrill 2014-06-19 13:51:11 UTC
Created from redmine issue http://projects.theforeman.org/issues/6288

Comment 4 Bryan Kearney 2015-08-25 17:24:27 UTC
Upstream bug component is Pulp

Comment 7 Brad Buckingham 2016-08-03 20:26:07 UTC
In Satellite 6.2, several enhancements were introduced to clean up the content on the capsule; however, there is an edge case that still needs to be addressed.

Scenario 1: A good/valid scenario/result
1. From Satellite, Capsule has environments Dev & Test associated
2. Capsule sync is performed
3. Capsule now has Dev & Test content
4. From Satellite, Capsule updated to only have environment Test
5. Capsule sync is performed
6. Capsule updated to only have environment Test content

Scenario 2: A bad/invalid scenario/result
1. From Satellite, Capsule has environment Test associated
2. From Satellite, Capsule environment Test is removed
3. Capsule sync is performed
4. Capsule still has Test content


Note: in 6.2 the user does still need to manually trigger a capsule sync.

Comment 8 Bryan Kearney 2016-08-03 22:01:41 UTC
Upstream bug component is Pulp

Comment 9 Justin Sherrill 2016-09-07 13:01:14 UTC
*** Bug 1269163 has been marked as a duplicate of this bug. ***

Comment 10 Michael Hrivnak 2016-12-13 21:02:52 UTC
Brad, I see the upstream category in the foreman redmine is "Pulp"; is that why it's in the Pulp component in BZ? Is that a strict mapping?

It would be helpful to us if the Pulp component in BZ only contained issues where Pulp has some next steps to take, but I'm happy to do whatever is best for the rest of Satellite, since ultimately that is who all this BZ content benefits.

For this issue specifically, there are no changes required from Pulp, so I'm hoping to move it to a different component.

Comment 11 Michael Hrivnak 2016-12-19 21:17:38 UTC
Moving the component back to Capsule since it does not appear to require any Pulp changes.

Comment 30 Justin Sherrill 2019-08-19 17:42:36 UTC
Satellite 6.4 and Satellite 6.5 have the following behavior:

* On every sync, unneeded repositories are deleted
* Once a week via a cron job, content that are no longer needed (rpms, puppet modules, etc..) are cleaned deleted

Starting with Satellite 6.6, both of these jobs belong to this weekly cron job.  Thus the following works fine:

1.  Sync some lifecycle environment to a capsule
2.  Remove the lifecycle environment from the capsule
3.  Wait a week, or run  foreman-rake katello:delete_orphaned_content

the repositories and all their content should be deleted from the capsule.

I suggest we propose as ON_QA for 6.6

Comment 31 Lukas Pramuk 2019-09-05 16:08:12 UTC
Tested with Satellite 6.6.0 Snap18 and doesn't behave like stated in comment#30

Content is not removed not only upon last LFE removal but basically upon any LFE removal and foreman-rake katello:delete_orphaned_content doesn't help at all.

Switching back to NEW then. Integration with pulp seems to be broken yet more?


# pulp-admin rpm repo list | grep -e Name: -e Rpm:

>>> Library content still present

Display Name:        RHEL 7.7
  Rpm:                    5225
Display Name:        Red Hat Satellite Maintenance 6 for RHEL 7 Server RPMs
  Rpm:     33
Display Name:        Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
  Rpm:                    26176
Display Name:        Capsule 6.6 RHEL7
  Rpm:                    207
Display Name:        Red Hat Software Collections RPMs for Red Hat Enterprise
  Rpm:                    11326
Display Name:        Red Hat Ansible Engine 2.8 RPMs for Red Hat Enterprise
  Rpm:                    8

>>> Dev content should be also removed

Display Name:        Capsule 6.6 RHEL7
  Rpm:                    207
Display Name:        Capsule 6.6 RHEL7
  Rpm:                    207


# pulp-admin orphan list
+----------------------------------------------------------------------+
                                Summary
+----------------------------------------------------------------------+

Distribution:            0
Docker Blob:             0
Docker Image:            0
Docker Manifest:         0
Docker Manifest List:    0
Docker Tag:              0
Drpm:                    0
Erratum:                 0
Iso:                     0
Modulemd:                0
Modulemd Defaults:       0
Ostree:                  0
Package Category:        0
Package Environment:     0
Package Group:           0
Package Langpacks:       0
Puppet Module:           0
Rpm:                     0
Srpm:                    0
Yum Repo Metadata File:  0
Total:                   0

>>> There are no orphans made that's why foreman-rake katello:delete_orphaned_content has no effect

Comment 32 Justin Sherrill 2019-09-12 13:23:37 UTC
Fixed as part of upstream issue 27795

Comment 36 Lukas Pramuk 2019-09-29 09:29:37 UTC
VERIFIED.

@Satellite 6.6.0 Snap21
tfm-rubygem-katello-3.12.0.25-1.el7sat.noarch

the behavior in Satellite 6.6.0 as per comment#30 has changed therefore used this reproducer:

1) Assign a LFE to the capsule

2) At the capsule check for content:
# pulp-admin rpm repo list | grep -e Name: -e Rpm:
Display Name:        Capsule 6.6 RHEL7
  Rpm:                    208
Display Name:        Maintenance 6.6 RHEL7
  Rpm:           15
Display Name:        RHEL 7.7
  Rpm:                    5225

3) Unassign the LFE from the capsule

4) Force to run weekly clean up task:
# foreman-rake katello:delete_orphaned_content
Orphaned content deletion started in background.
Orphaned content deletion started in background.

5) At the capsule check for content again:
# pulp-admin rpm repo list | grep -e Name: -e Rpm:
<empty>

>>> weekly task katello:delete_orphaned_content now properly removes all content of unassigned LFEs

Comment 38 errata-xmlrpc 2019-10-22 12:46:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3172


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