How to delete/purge the content view version of specific content view through CLI in Red Hat Satellite 6
Environment
- Red Hat Satellite 6.x
Issue
- Unable to delete/purge content view version sequentially or randomly in bulk through Red Hat Satellite Web UI
Resolution
Method 1:
-
This will delete the content-view versions sequentially i.e 3-5 from the content view id 2. So, basically the below command is to run for each content view having multiple content_view_version in sequence.
for content_view_version in {3..5}; do hammer content-view version delete --content-view-id 2 --id $content_view_version --organization-id 1; done;-
Note: Kindly find organization id from below command and replace accordingly.
From satellite cli runhammer organization list -
Replace content_view_version id's and content -view id accordingly.
-
Method 2:
-
This method will delete the CV versions randomly as per their ID. We can run the following on the satellite cli and it will delete the specific versions in bulk.`
-
Kindly create a bash file.
vi abc.sh -
Copy the below code for multiple content view versions id's in abc.sh for content-view id 3
array=(30 38 41 43 44 52 56 61 65 68 74 75 77 80 85 88 91 92 94 99 104 106 107 110 111 126 128 131) for i in "${array[@]}" do hammer content-view version delete --content-view-id 3 --id $i --organization-id 1 done -
Give the execute permission
chmod +x abc.sh -
Execute the script
./abc.sh
-
For additional reference refer How to remove old content view versions in Red Hat Satellite 6 using CLI/hammer?
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments