Problem: running hammer content-view purge --count # --id ## is not deleting old versions of content views for all views. For instance, I have the following content-view with said versions:
----|-------------|---------|-------------------------------------------|-----------------------
ID | NAME | VERSION | DESCRIPTION | LIFECYCLE ENVIRONMENTS
----|-------------|---------|-------------------------------------------|-----------------------
457 | Jenkins 9.0 | 9.0 | Published on Sun Sep 10 01:24:38 EDT 2023 | Library
436 | Jenkins 8.0 | 8.0 | Published on Sun Sep 3 01:24:07 EDT 2023 |
417 | Jenkins 7.0 | 7.0 | Published on Sun Aug 27 01:01:05 EDT 2023 |
395 | Jenkins 6.0 | 6.0 | Published on Sun Aug 20 01:01:00 EDT 2023 |
376 | Jenkins 5.0 | 5.0 | Published on Sun Aug 13 01:01:09 EDT 2023 |
357 | Jenkins 4.0 | 4.0 | Published on Sun Aug 6 01:00:56 EDT 2023 |
336 | Jenkins 3.0 | 3.0 | Published on Sun Jul 30 01:00:59 EDT 2023 |
----|-------------|---------|-------------------------------------------|-----------------------
if I run the command hammer content-view purge --count 4 --id xx
I just get the output:
No versions to delete
There are no errors when I try to delete from the GUI
Expected outcome: I expect this command to delete all but the X most recent versions
Foreman and Proxy versions: 3.7
Foreman and Proxy plugin versions:
Name | Description | Author | Version |
---|---|---|---|
foreman-tasks | The goal of this plugin is to unify the way of showing task statuses across the Foreman instance. It defines Task model for keeping the information about the tasks and Lock for assigning the tasks to resources. The locking allows dealing with preventing multiple colliding tasks to be run on the same resource. It also optionally provides Dynflow infrastructure for using it for managing the tasks. | Ivan Nečas | 8.1.1 |
foreman_ansible | Ansible integration with Foreman | Daniel Lobato Garcia | 12.0.4 |
foreman_remote_execution | A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality. | Foreman Remote Execution team | 10.0.1 |
foreman_webhooks | Plugin for Foreman that allows to configure Webhooks. | Timo Goebel | 3.2.1 |
katello | Katello adds Content and Subscription Management to Foreman. For this it relies on Candlepin and Pulp. | N/A | 4.9.0 |
Distribution and version: Rocky Linux 8.8
Other relevant data:
If it’s relevant, I’m currently using composite content views.
Here is a bash script I’m using to handle version management of my content-views:
#!/usr/bin/env bash
# Reference link: https://archyslife.blogspot.com/2020/01/foreman-automatic-content-view-promotion.html
# Variables
ORGANIZATION_LABEL='COMPANY'
# For loop will dynamically run across all non-Composite Content Views with the exception of those in the Default Organization
for content_view_id in $(hammer content-view list --organization-label $ORGANIZATION_LABEL --composite false | egrep -vi 'default' | awk '{print $1}' | egrep '^[1-9]' | egrep -v '14' | awk NF); do
hammer content-view publish --id $content_view_id --organization-label $ORGANIZATION_LABEL --description "Published on $(date)"
# Keep only four versions published
hammer content-view purge --count 4 --id $content_view_id
done
# For loop will dynamically run across all Composite Content Views with the exception of those in the Default Organization
for content_view_id in $(hammer content-view list --organization-label $ORGANIZATION_LABEL --composite true | egrep -vi 'default' | awk '{print $1}' | egrep '^[1-9]' | egrep -v '14' | awk NF); do
hammer content-view publish --id $content_view_id --organization-label $ORGANIZATION_LABEL --description "Published on $(date)"
# Keep only four versions published
hammer content-view purge --count 4 --id $content_view_id
done