RedHatSatellite/katello-cvmanager

ccv new version not published

Opened this issue · 11 comments

hello, i try to publish & promote my ccv automatically. For CV´s it works. But for CCV´s no new version would be published. Where is my mistake?

`---
:settings:
:user: admin
:pass:
:uri: https://lnx-rbg40.int.osram-light.com
:timeout: 300
:org: 1
:lifecycle: 7
:keep: 5
:checkrepos: true
:promote_cvs: true

:ccv:
ccv-rhel7-base:
cv-rhel7: latest
cv-rhel7-tools: latest

:publish:

  • cv-rhel7-tools
  • cv-rhel7
  • ccv-rhel7-base

:promote:

  • ccv-rhel7-base`

we have the same issue on satellite 6.4

In Satellite 6.4 latest seems to be ignored and the one selected in the web UI is used instead. Any pointers?

@evgeni I asked on IRC already and also made a ticket at Red Hat. Can you have a look or help me to find someone who can help to get this solved?

@techsolo @RogerTanner have you tried out #53 ?

I currently don't work for a company with a Satellite, so I can't validate on this. But I am actually pretty sure that I pulled your fork and tested again with the same result.

I had the same issue and i resolved it by unset "latest" and set a fixed version of content view in CCV.

I had the same issue and i resolved it by unset "latest" and set a fixed version of content view in CCV.

Check the result you always get that fixed version, never 'latest'.

Looks like when one sets a component cv in a ccv to latest, Satellite will always return the latest version of the unpublished ccv rather than the version of the last published version. As a result, cvmanager can't determine that the cv has changed and wont re-publish the ccv.

If cvmanager would check the versions of the last published version of the ccv and not the current versions of the unpublished ccv, this should resolve this issue. Until then you can change the latest value in the ccv to any specific version and let cvmanager manage things, as others have found.

Came up with a patch to fix this if all you want is things to promote properly even when a component version is set to latest in the UI.

If there's interest I'll stick it behind a feature flag, clean up the output to be more accurate, and put in an MR to get that merged.

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})

@arusso this looks interesting, thanks. Definitely open up a PR for that please.

Is this problem fixed now?