Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1162799

Summary: Cannot add a puppet module to a content view by name
Product: Red Hat Satellite Reporter: Elyézer Rezende <erezende>
Component: HammerAssignee: David Davis <daviddavis>
Status: CLOSED ERRATA QA Contact: Kedar Bidarkar <kbidarka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: NightlyCC: bbuckingham, daviddavis, kbidarka, riehecky
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/8583
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:19:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Elyézer Rezende 2014-11-11 17:35:06 UTC
Description of problem:
Trying to add a puppet module to a content view by name fails while using the puppet module id works. 


Version-Release number of selected component (if applicable):
hammer (0.1.3)
 * hammer_cli_import (0.10.4)
 * hammer_cli_katello (0.0.6)
 * hammer_cli_foreman (0.1.3)

How reproducible:
Aways


Steps to Reproduce:
1. Create a repository and synchronize it
2. Create a content view
3. List the puppet modules and choose one
4. Try to add a puppet module to a content view by its name

Actual results:
The command fail with the following error message:

Error: content_view_puppet_module not found
Could not add the puppet module:
  Error: content_view_puppet_module not found

Expected results:
The puppet module added to the content view


Additional info:

Adding by name
--------------

# LANG=en_US.UTF-8 hammer -v -u admin -p changeme  --output csv puppet-module list --repository-id='157'
ID,Name,Author,Version
81b2c255-22db-48ba-951d-b48bbf2e374c,pureftpd,5UbZ3r0,1.0.2
b3d6fcdd-72ba-4ca4-a5f3-763b4223f5dd,cron,5UbZ3r0,0.0.1
bd89d01d-84fd-4075-8771-2d8260a50153,ntp,puppetlabs,3.2.1
04d60c64-30b7-4138-9e6a-ee30eb23b221,samba,5UbZ3r0,0.2.0
378e4b76-0f90-4986-bc6f-c13dd2047f05,httpd,5UbZ3r0,0.2.0

# LANG=en_US.UTF-8 hammer -v -u admin -p changeme  --output csv content-view puppet-module add --content-view-id='305' --name='samba'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/../abstract.rb:67: warning: already initialized constant DEFAULT_LABEL_INDENT
[ERROR 2014-11-11 12:21:34 Exception] Error: content_view_puppet_module not found
Could not add the puppet module:
  Error: content_view_puppet_module not found
[ERROR 2014-11-11 12:21:34 Exception]

HammerCLIForeman::ResolverError (content_view_puppet_module not found):
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/id_resolver.rb:140:in `pick_result'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/id_resolver.rb:136:in `find_resource'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/id_resolver.rb:114:in `get_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/id_resolver.rb:108:in `content_view_puppet_module_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:143:in `send'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:143:in `get_resource_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:132:in `get_identifier'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:180:in `customized_options'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:185:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_katello-0.0.6/lib/hammer_cli_katello/content_view_puppet_module.rb:35:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/command.rb:42:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:164:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/command.rb:33:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:68:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:68:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:68:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:68:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:126:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/bin/hammer:106
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

Adding by ID
------------

# LANG=en_US.UTF-8 hammer -v -u admin -p changeme  --output csv puppet-module list --repository-id='159'
ID,Name,Author,Version
81b2c255-22db-48ba-951d-b48bbf2e374c,pureftpd,5UbZ3r0,1.0.2
b3d6fcdd-72ba-4ca4-a5f3-763b4223f5dd,cron,5UbZ3r0,0.0.1
bd89d01d-84fd-4075-8771-2d8260a50153,ntp,puppetlabs,3.2.1
04d60c64-30b7-4138-9e6a-ee30eb23b221,samba,5UbZ3r0,0.2.0
378e4b76-0f90-4986-bc6f-c13dd2047f05,httpd,5UbZ3r0,0.2.0

# LANG=en_US.UTF-8 hammer -v -u admin -p changeme  --output csv content-view puppet-module add --content-view-id='309' --id='81b2c255-22db-48ba-951d-b48bbf2e374c'
Message,Id,Name
Puppet module added to content view,5,pureftpd

Comment 2 Partha Aji 2014-12-04 15:50:41 UTC
Created redmine issue http://projects.theforeman.org/issues/8583 from this bug

Comment 3 Bryan Kearney 2015-01-15 01:04:44 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/8583 has been closed
-------------
David Davis
Applied in changeset commit:hammer-cli-katello|d08b9834dd43a58104d34311ad485f50649686c1.

Comment 6 Kedar Bidarkar 2015-02-13 11:44:49 UTC
[root@xxxx puppet_module]# hammer -u admin -p changeme content-view puppet-module add --content-view-id=6 --name samba
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/lib/hammer_cli/./apipie/../abstract.rb:68: warning: already initialized constant DEFAULT_LABEL_INDENT
Puppet module added to content view


[root@xxxx puppet_module]# hammer -u admin -p changeme content-view list --organization-id 1
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/lib/hammer_cli/./apipie/../abstract.rb:68: warning: already initialized constant DEFAULT_LABEL_INDENT
----------------|---------------------------|---------------------------|-----------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------
1               | Default Organization View | Default_Organization_View |           |
5               | docker_cv                 | docker_cv                 |           | 12
3               | example_cv                | example_cv                |           | 2
6               | puppet2_cv                | puppet2_cv                |           |
4               | puppet_repo               | puppet_repo               |           |
2               | rhel66_cv                 | rhel66_cv                 |           | 2, 1
----------------|---------------------------|---------------------------|-----------|---------------




[root@xxxx puppet_module]# hammer -u admin -p changeme content-view info --id 6 --organization-id 1
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/lib/hammer_cli/./apipie/../abstract.rb:68: warning: already initialized constant DEFAULT_LABEL_INDENT
ID:                     6
Name:                   puppet2_cv
Label:                  puppet2_cv
Composite:
Description:
Content Host Count:     0
Organization:           Default Organization
Yum Repositories:

Docker Repositories:

Puppet Modules:
 1) ID:      3
    Name:    samba
    Author:  5UbZ3r0
    Created: 2015/02/13 11:42:12
    Updated: 2015/02/13 11:42:12


VERIFIED with sat6.1-Beta-SNAP1

Comment 7 Kedar Bidarkar 2015-02-13 11:45:58 UTC
update: VERIFIED with sat6.1-Beta-SNAP2

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

Comment 9 errata-xmlrpc 2015-08-12 05:19:03 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