From 6672b1c3f9725ee644343703bfc73c77ef8e2de8 Mon Sep 17 00:00:00 2001 From: Fabrizio2210 <34220075+fabrizio2210@users.noreply.github.com> Date: Wed, 25 Jul 2018 15:51:12 +0200 Subject: [PATCH] Fix due to Katello Bug #23458 The information by content_view_versions API is not always true. So cvmanager could try to delete some locked Content View Version. --- cvmanager | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cvmanager b/cvmanager index 7b24418..2f2cbd2 100755 --- a/cvmanager +++ b/cvmanager @@ -182,10 +182,15 @@ def clean() else puts " removing #{version['version']}" if not @options[:noop] - req = @api.resource(:content_view_versions).call(:destroy, {:id => version['id']}) - tasks << req['id'] - if @options[:sequential] > 0 and tasks.length >= @options[:sequential] - tasks = wait(tasks) + begin + req = @api.resource(:content_view_versions).call(:destroy, {:id => version['id']}) + tasks << req['id'] + if @options[:sequential] > 0 and tasks.length >= @options[:sequential] + tasks = wait(tasks) + end + rescue + puts " Impossible to delete version \"#{version['id']}\"" + puts " Probably it is locked by a Composite Content View" end else puts " [noop] would delete content view version with id #{version['id']}"