Bug 924783 - Document running pulp-purge-packages to delete orphaned packages
Summary: Document running pulp-purge-packages to delete orphaned packages
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: Documentation
Version: 2.1.1
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: ---
: 2.1.2
Assignee: Julie
QA Contact: Dan Macpherson
URL:
Whiteboard:
: 924781 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-22 13:50 UTC by James Slagle
Modified: 2016-02-18 05:39 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
New technical material on the 'pulp-purge-packages' script was required. This update adds Chapter 13. Deleting Orphaned Packages in the Red Hat Update Infrastructure Administration Guide.
Clone Of:
Environment:
Last Closed: 2013-04-23 11:42:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0767 0 normal SHIPPED_LIVE Red Hat Update Infrastructure 2.1.2 bug fix update 2013-04-23 15:40:53 UTC

Description James Slagle 2013-03-22 13:50:01 UTC
We need to add some new content to the Administration Guide for running a script we'll be shipping on the RHUA and CDS about how to run the script to delete orphaned packages from the filesystem.

Comment 1 James Slagle 2013-03-22 13:52:09 UTC
i will be adding the technical material to the bug

Comment 2 James Slagle 2013-03-22 19:29:43 UTC
We probably want this material to be in a new section in the Administration
Guide.

Material:

RHUI does not delete packages from the filesystem when those packages are no
longer referenced by any repositories.  This causes the package files
themselves to remain on disk and consume space.

There are 2 config options in /etc/pulp/pulp.conf that can cause packages to
become unreferenced, and thus candidates to be deleted to reclaim disk space.
The options in /etc/pulp/pulp.conf are:

[yum]
# True/False to flag if we should remove older rpms
remove_old_versions: false
# Integer to specify how many old packages to keep.
num_old_pkgs_keep: 2

Set 'num_old_pkgs_keep' to the number of old versions of packages to have
available in a repository.  If available, RHUI will sync the latest version of
each package, as well as the configured number of older versions of each
package for a given repository.

Set 'remove_old_versions' to true to have RHUI delete references to old package
versions beyond 'num_old_pkgs_keep'.  

Another way packages can become unreferenced is through repository deletion.

Once references are deleted, the 'pulp-purge-packages' script can be used to
delete unreferenced packages and reclaim disk space.  'pulp-purge-packages' can
be run with a '--dry-run' option to see what it will delete before actually
deleting any packages off disk.  The script logs to
/var/log/pulp-purge-packages.  After reviewing the output from running with
'--dry-run', run without that option to actually delete the packages.

'pulp-purge-packages' will automatically detect the packages and repository
directories to use to delete packages, so it can be run interchangeably on both
the RHUA and CDS servers.  Or, these options can be specified on the command
line.

Note: httpd must be stopped before running 'pulp-purge-packages'

Note: 'pulp-purge-packages' deletes all unreferenced packages.  If 'pulp-admin
content upload' has been used to upload packages, and those packages have not
been associated with any repositories, those packages will be deleted.

The script should be run as root.

Example output:
[root@rhui2-cds01 ~]# pulp-purge-packages --help
Usage: pulp-purge-packages [options]

Options:
  -h, --help            show this help message and exit
  -p PACKAGES_DIR, --packages-dir=PACKAGES_DIR
                        packages directory to purge of orphaned packages (will
                        be detected if not specified)
  -r REPOS_DIR, --repos-dir=REPOS_DIR
                        repository directory to search for referenced packages
                        (will be detected if not specified)
  -d, --dry-run         dry run only, do not actually purge any packages


[root@rhui2 ~]# pulp-purge-packages --dry-run
2013-03-22 15:28:20,405 - Starting run of ./pulp-purge-packages

WARNING: httpd must be stopped before this script can be run.

WARNING: This script will delete all packages not associated with any repositories.  Including packages that were uploaded with the 'pulp-admin content upload' command.

Continue? Y/N: y

2013-03-22 15:28:21,550 - Detecting packages and repository directories.
2013-03-22 15:28:21,551 - Using /var/lib/pulp/repos as repository directory.
2013-03-22 15:28:21,551 - Using /var/lib/pulp/packages as packages directory to purge.
2013-03-22 15:28:21,551 - Dry run specificed, No actual deletes will occur.
2013-03-22 15:28:21,552 - Getting all referenced packages, this may take a few minutes...
<logging of found packages to delete>

Comment 3 Dan Macpherson 2013-03-25 05:24:17 UTC
*** Bug 924781 has been marked as a duplicate of this bug. ***

Comment 5 Dan Macpherson 2013-03-26 04:47:18 UTC
Verified new chapter added. However, you might need to add a step to start the httpd service again after completing the purge process in Procedure 13.2.

Comment 6 James Slagle 2013-03-26 17:55:08 UTC
Correct, a start of httpd is needed at the end (sorry I missed that).

A couple of other feedback items:

There are 2 ways you can end up with orphaned packages:
1. Setting the config options as shown above
2. Deleting a repository

The first sentence in Procedure 13.2 makes it sound like it's only be deleting a repository (to me anyway).

The Note after step 2 does not look complete.  Running with --dry-run does not affect where the script logs.  It could instead say something like:

After reviewing the output from running with '--dry-run', run without that option to actually delete the packages.

Then maybe another Note that says:
The script logs to /var/log/pulp-purge-packages.

Comment 8 Dan Macpherson 2013-04-09 06:49:10 UTC
Verified changes.

Comment 10 errata-xmlrpc 2013-04-23 11:42:13 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.

http://rhn.redhat.com/errata/RHBA-2013-0767.html


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