Bug 1186353 - Composite content view publish puppet module by specified version (uuid) not working
Summary: Composite content view publish puppet module by specified version (uuid) not ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Management
Version: 6.0.7
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Justin Sherrill
QA Contact: Og Maciel
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2015-01-27 13:51 UTC by Peter Vreman
Modified: 2017-02-23 20:38 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-12 05:22:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Update version of content view (95.30 KB, image/png)
2015-03-06 22:44 UTC, Og Maciel
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 9131 0 None None None 2016-04-22 16:53:04 UTC
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

Description Peter Vreman 2015-01-27 13:51:24 UTC
Description of problem:
The code to publish a content view uses “uuid”, if not available it falls back to latest version:

  def computed_module_ids_by_repoid
    # In order to copy the puppet modules to the new repo, we need to retrieve the module
    # details.  This is necessary since pulp requires both a source and destination
    # repo id to copy content.
    ids = []
    names_and_authors = []
    puppet_modules_to_publish.each do |cvpm|
      if cvpm.uuid
        ids << cvpm.uuid
      else
        names_and_authors << { :name => cvpm.name, :author => cvpm.author }
      end
    end

    puppet_modules = ids.blank? ? [] : PuppetModule.id_search(ids)
    unless names_and_authors.blank?
      puppet_modules << PuppetModule.latest_modules_search(names_and_authors,
                                                           self.organization.library.repositories.puppet_type.map(&:pulp_id))
    end

The code to retrieve the list of puppet modules to publish is from this method that makes a difference between composite and not. For the composite it uses the details from a composite view version:

  def puppet_modules_to_publish
    if composite?
      components.flat_map { |version| version.puppet_modules }
    else
      content_view_puppet_modules
    end
  end

Composite content view version returns the following details, and those do not include the uuid that is used in computed_module_ids_by_repoid:


curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/katello/api/v2/content_views/41 | hoi-json - --get ALL | egrep 'puppet_modules'
components.0.puppet_modules.0.author=puppetlabs
components.0.puppet_modules.0.id=dc4e90b4-490b-4974-8fd6-4d4fc4a8a161
components.0.puppet_modules.0.name=stdlib
components.0.puppet_modules.0.version=4.3.2




Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
Composite content views always have the latest available puppet module versions included instead of the specified version

Expected results:
The specified puppet module version is used in the composite content view


Additional info:

Comment 2 Justin Sherrill 2015-01-27 14:12:20 UTC
Created redmine issue http://projects.theforeman.org/issues/9131 from this bug

Comment 3 Bryan Kearney 2015-01-30 13:05:14 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9131 has been closed
-------------
Justin Sherrill
Applied in changeset commit:katello|8ad61197895c1ad3d9494000dc24d2799fcc0e96.

Comment 4 Bryan Kearney 2015-02-09 20:02:22 UTC
There are no tickets associated to this, moving to 6.1

Comment 6 Og Maciel 2015-03-06 22:44:14 UTC
Created attachment 999017 [details]
Update version of content view

The attached screenshot shows that in order for your published composite content view to get access to newer versions of a puppet module, you need to make sure that you edit the existing content view with the newer puppet module and then re-publish your composite content view.

Comment 7 Og Maciel 2015-03-06 23:11:56 UTC
* Created a custom product a custom puppet based repository
* Added 2 versions of the puppet lap apache module to said repository
* Created content view PuppetCV and added version 1.0.0 of apache module
* Published PuppetCV
* Created a composite content view named Tutti
* Added PuppetCV to Tutti and published Tutti

Filesystem shows:

# cat /etc/puppet/environments/KT_Default_Organization_Library_Tutti_9/modules/apache/metadata.json |grep version
  "version": "1.0.0",
      "version_requirement": "3.2.x"
      "version_requirement": "3.x"
      "version_requirement": ">= 2.4.0"
      "version_requirement": ">= 1.0.0"
    "manifests/version.pp": "81d6349fd3f4c80e89c8b73c724895d9",
    "spec/acceptance/version.rb": "a7d6f86a6c457c29ca36810f3e722a99",

* Updated PuppetCV and updated the version of the apache module to version 1.3.0
* Published PuppetCV again
* Updated Tutti to use newer version of PuppetCV and republished Tutti

Filesystem shows:

# cat /etc/puppet/environments/KT_Default_Organization_Library_Tutti_9/modules/apache/metadata.json |grep version
  "version": "1.0.0",
      "version_requirement": "3.2.x"
      "version_requirement": "3.x"
      "version_requirement": ">= 2.4.0"
      "version_requirement": ">= 1.0.0"
    "manifests/version.pp": "81d6349fd3f4c80e89c8b73c724895d9",
    "spec/acceptance/version.rb": "a7d6f86a6c457c29ca36810f3e722a99",


Therefore it doesn't look like the composite content view contains the newer version of apache.

Comment 8 Og Maciel 2015-03-06 23:18:31 UTC
Failed on Satellite-6.1.0-RHEL-6-20150303.0

Comment 9 Justin Sherrill 2015-03-09 13:10:22 UTC
Og, given your steps you followed here:



* Created a custom product a custom puppet based repository
* Added 2 versions of the puppet lap apache module to said repository
* Created content view PuppetCV and added version 1.0.0 of apache module
* Published PuppetCV
* Created a composite content view named Tutti
* Added PuppetCV to Tutti and published Tutti


i would not expect the composite to have a 'newer' version of apache as version 1.0.0 is in the PuppetCV component.  Did you miss writing a step in the list?

Comment 10 Justin Sherrill 2015-03-13 17:49:30 UTC
ohh i missed the following steps:

* Updated PuppetCV and updated the version of the apache module to version 1.3.0
* Published PuppetCV again
* Updated Tutti to use newer version of PuppetCV and republished Tutti

will try to reproduce

Comment 11 Justin Sherrill 2015-05-05 17:08:42 UTC
Og,

The issue you are hitting is with: https://pulp.plan.io/issues/663

which should be resolved in pulp 2.6.1. However since there is no BZ opened it has not been cherrypicked.  I have opened https://bugzilla.redhat.com/show_bug.cgi?id=1218727

Please try again to reproduce with a module that does not contain a symlink.

-Justin

Comment 12 Og Maciel 2015-05-21 21:42:10 UTC
Followed the same steps as described on comment #7 except that I used versions 1.0.0 and 1.4.1 of the puppetlabs/apache module:

[root@ibm-x3250m4-06 ~]# cat /etc/puppet/environments/KT_Default_Organization_Library_Tutti_6/modules/apache/metadata.json | grep version
  "version": "1.0.0",
      "version_requirement": "3.2.x"
      "version_requirement": "3.x"
      "version_requirement": ">= 2.4.0"
      "version_requirement": ">= 1.0.0"
    "manifests/version.pp": "81d6349fd3f4c80e89c8b73c724895d9",
    "spec/acceptance/version.rb": "a7d6f86a6c457c29ca36810f3e722a99",
[root@ibm-x3250m4-06 ~]#
[root@ibm-x3250m4-06 ~]#
[root@ibm-x3250m4-06 ~]#
[root@ibm-x3250m4-06 ~]# cat /etc/puppet/environments/KT_Default_Organization_Library_Tutti_6/modules/apache/metadata.json | grep version
  "version": "1.4.1",
      "version_requirement": ">= 3.7.0 < 4.0.0"
      "version_requirement": "3.x"
    {"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0 < 5.0.0"},
    {"name":"puppetlabs/concat","version_requirement":">= 1.1.1 < 2.0.0"}

also

GET /katello/api/v2/content_views/5/content_view_puppet_modules where 5 is the content view ID for my PuppetCV content view shows that version 1.4.1 is the version present:

{"total":1,"subtotal":1,"page":1,"per_page":20,"search":null,"sort":{"by":null,"order":null},"results":[{"id":3,"uuid":"703b6d3b-6e0e-44cb-8886-8864a5937c08","name":"apache","author":"puppetlabs","created_at":"2015-05-21T21:24:37Z","updated_at":"2015-05-21T21:28:46Z","computed_version":"1.4.1","puppet_module":{"id":"703b6d3b-6e0e-44cb-8886-8864a5937c08","name":"apache","version":"1.4.1","author":"puppetlabs","summary":"Installs, configures, and manages Apache virtual hosts, web services, and modules.","description":"Module for Apache configuration","license":"Apache-2.0","project_page":"https://github.com/puppetlabs/puppetlabs-apache","source":"git://github.com/puppetlabs/puppetlabs-apache.git","dependencies":[{"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0 < 5.0.0"},{"name":"puppetlabs/concat","version_requirement":">= 1.1.1 < 2.0.0"}],"checksums":[],"tag_list":null,"repoids":["Default_Organization-Puppet_CV-2_0","Default_Organization-Puppet_Modules-Apache","Default_Organization-Library-Tutti","Default_Organization-Tutti-2_0","Default_Organization-Library-Puppet_CV"],"repositories":[{"id":37,"name":"Apache","label":"Apache","organization":{"name":"Default Organization","label":"Default_Organization","id":1},"created_at":"2015-05-21T21:22:47Z","updated_at":"2015-05-21T21:22:50Z","content_type":"puppet","docker_upstream_name":null,"unprotected":true,"full_path":"http://ibm-x3250m4-06.lab.eng.rdu2.redhat.com/pulp/repos/Default_Organization/Library/custom/Puppet_Modules/Apache","checksum_type":null,"container_repository_name":null,"url":null,"relative_path":"Default_Organization/Library/custom/Puppet_Modules/Apache","major":null,"minor":null,"gpg_key_id":null,"content_id":"1432243368904","content_view_version_id":1,"library_instance_id":null,"product_type":"custom","promoted":false,"content_counts":{"docker_image":0,"docker_tag":0,"rpm":0,"package":0,"package_group":null,"erratum":0,"puppet_module":2},"permissions":{"deletable":true},"content_view_environments":[],"last_sync_words":null,"":null,"product":{"id":123,"cp_id":"1432216959725","name":"Puppet Modules","sync_plan":null},"environment":{"id":1},"last_sync":null}]}}]}

Comment 13 Bryan Kearney 2015-08-11 13:36:39 UTC
This bug is slated to be released with Satellite 6.1.

Comment 14 errata-xmlrpc 2015-08-12 05:22:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:1592


Note You need to log in before you can comment on or make changes to this bug.