From 1f7deb62c250c2a94de98aa59f6cf3840a0212e1 Mon Sep 17 00:00:00 2001 From: Aaron Russo Date: Thu, 25 Apr 2019 15:19:04 -0700 Subject: [PATCH] Fix update to work when CCV component uses latest Fixes #61 --- cvmanager | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cvmanager b/cvmanager index c9d01f3..69c5a09 100755 --- a/cvmanager +++ b/cvmanager @@ -293,9 +293,12 @@ def update() puts_verbose " Found #{desired_version} as the 'latest' version" end - # if the version of the component does not match the one the user requested update it - if component['version'].to_s != desired_version.to_s - puts " Updating from #{component['version']} to #{desired_version}" + # if the component version in the most recently published composite version does not match the one the user requested update it + ccv_latest_version = ccv['versions'].select { |obj| obj['version'] == ccv['latest_version'] }.first + component_cvv = @api.resource(:content_view_versions).call(:index, {:composite_version_id => ccv_latest_version['id'], :organization_id => @options[:org], :content_view_id => component['content_view']['id'] }) + component_cvv_version = component_cvv['results'].first['version'] + if component_cvv_version != desired_version.to_s + puts " Updating from #{component_cvv_version} to #{desired_version}" oldids = ids.dup ids.delete(component['id']) cvversions = @api.resource(:content_view_versions).call(:index, {:content_view_id => component['content_view']['id'], :version => desired_version})