Chapter 13. Deleting Orphaned Packages
pulp-purge-packages script.
Important
Procedure 13.1. Deleting Orphaned Packages by modifying configuration settings
- On the Red Hat Update Appliance Server, open
/etc/pulp/pulp.confin your preferred text editor. Setremove_old_versionstotrueto have Red Hat Update Infrastructure delete references to old packages versions beyond the versions specified innum_old_pkgs_keep.# True/False to flag if we should remove older rpms remove_old_versions: true # Integer to specify how many old packages to keep. num_old_pkgs_keep: 2
Procedure 13.2. Deleting Orphaned Packages from a CDS
- Open
/etc/pulp/cds/cds.confin your preferred text editor. - Set
cds_remove_old_versionstotrue.Note
Settingremove_old_versionstotrueon the Red Hat Update Appliance server andcds_remove_old_versionstofalseon the CDS will result in errors as the CDS will attempt to synchronize packages that no longer exist on the Red Hat Update Appliance server.To correct this set both totrueto remove all old packages beyond the version specified bynum_old_pkgs_keepor setremove_old_packagestofalseon the Red Hat Update Appliance server to retain all old packages and make the required changes for the CDS. - Set
num_old_pkgs_keepto the required number of packages to keep.Note
Make sure thatnum_old_pkgs_keepon the CDS is set to the same or lower than on the Red Hat Update Appliance server ifremove_old_versionsistrueon the Red Hat Update Appliance server to ensure that the CDS is not trying to synchronize packages that do not exist on the Red Hat Update Appliance server. - Save and exit the file.
# True/False to flag if we should remove older rpms cds_remove_old_versions: true # Integer to specify how many old packages to keep. num_old_pkgs_keep: 2
This will remove old package versions beyond the versions specified innum_old_pkgs_keepon the CDS the next time it is synchronized.
Procedure 13.3. Deleting Orphaned Packages using the pulp-purge-packages script
- Stop the httpd service.
# service httpd stop
- View packages available for deletion.
# pulp-purge-packages --dry-run
- Run the
pulp-purge-packagesscript to delete orphaned packages and reclaim disk space.Warning
This script will delete all packages not associated with any repositories. Including packages that were uploaded with the 'pulp-admin content upload' command.# pulp-purge-packages
Note
Thepulp-purge-packagesscript logs to/var/log/pulp-purge-packages. - Start the httpd service.
# service httpd start
Note
pulp-purge-packages script automatically detects the packages and repositories for package deletion, so the script can be run interchangeably on both the Red Hat Update Appliance and CDS servers. View all options and commands by using the --help command:
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
Example 13.1. Example Script Output
[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>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.