Bug 1519779 - puppet classes info doesn't consider puppet environments parameter
Summary: puppet classes info doesn't consider puppet environments parameter
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Puppet
Version: 6.2.13
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Released
Assignee: Ondřej Pražák
QA Contact: Sanket Jagtap
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-01 12:58 UTC by Sanket Jagtap
Modified: 2019-10-07 17:19 UTC (History)
9 users (show)

Fixed In Version: foreman-1.20.0-0, rubygem-foreman_maintain-0.3.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:36:46 UTC


Attachments (Terms of Use)
hammer output with debug (10.95 KB, text/plain)
2017-12-01 12:58 UTC, Sanket Jagtap
no flags Details
6.2.13 puppet-class info (62.45 KB, image/png)
2017-12-13 12:35 UTC, Ondřej Pražák
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:36:54 UTC
Foreman Issue Tracker 24633 None None None 2018-08-16 10:45:01 UTC
Foreman Issue Tracker 24923 None None None 2018-09-18 14:27:35 UTC
Red Hat Bugzilla 1610695 None CLOSED Cannot use compute resource name parameter 2019-06-25 09:01:32 UTC

Internal Links: 1610695

Description Sanket Jagtap 2017-12-01 12:58:58 UTC
Created attachment 1361573 [details]
hammer output with debug

Description of problem:


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

How reproducible:
Always


Steps to Reproduce:
1. Have two puppet classes with same name in different environment

-bash-4.2#  hammer -u admin -p changeme  puppet-class list --environment="KT_9UEYTp_Library_wrzITAjOEQ_199"
----|----------------------------
ID  | NAME                       
----|----------------------------
1   | access_insights_client     
4   | foreman_scap_client        
5   | foreman_scap_client::params
122 | generic_1                  
2   | stdlib                     
3   | stdlib::stages             
----|----------------------------


-bash-4.2#  hammer -u admin -p changeme  puppet-class info --environment="KT_9UEYTp_Library_wrzITAjOEQ_199" --name="generic_1"
Error: found more than one puppetclass


The environment and environment-id parameter is not consider while looking for the class

Actual results:
Error: found more than one puppetclass

Expected results:
puppet class should be listed

Additional info:
Not a regression

Comment 2 Marek Hulan 2017-12-04 11:05:48 UTC
Sanket, could you please check whether you can achieve it through API? That will help us to find out, where is the issue. Thanks for hammer -d output, that helps too.

Comment 3 Sanket Jagtap 2017-12-04 13:12:44 UTC
Marek , will update you on this, as soon as I could get hold on upgrade RHEL7 box.
This only happens on the Upgrade RHEL7 box, and I was unable to reproduce the same with upgrade RHEL6 box.
On RHEL6 , even though the puppet class shared Environments I was able to list them successfully

hammer> puppet-class list --environment="KT_NPS3rZ_Library_aqaWndLuUR_197"
----|----------------------------
ID  | NAME                       
----|----------------------------
1   | access_insights_client     
2   | foreman_scap_client        
3   | foreman_scap_client::params
123 | generic_1                  
4   | stdlib                     
5   | stdlib::stages             
----|----------------------------
hammer> puppet-class info --environment="KT_NPS3rZ_Library_aqaWndLuUR_197" --name generic_1
Id:                     123
Name:                   generic_1
Smart variables:        
 1) Parameter:     
    Default value:
Smart class parameters: 
    generic_1_scp_001
    <truncated>
Hostgroups:             

Environments:           
    KT_NPS3rZ_Library_aqaWndLuUR_197
    KT_rQjElY_Library_dAXSrxvSDD_213
    KT_SjMpUy_Library_eijWCyKjfe_278
Parameters:

Comment 4 Ondřej Pražák 2017-12-13 12:35:48 UTC
Created attachment 1367326 [details]
6.2.13 puppet-class info

I fail to reproduce on newly installed 6.2.13

Comment 7 Sanket Jagtap 2017-12-26 06:22:54 UTC
Build: Satellite 6.3.0 snap 30 

This also started to appear with snap 30
PFA CLI hammer -d output and via API call

Comment 10 Sanket Jagtap 2018-07-09 11:41:46 UTC
Build: Satellite 6.4 snap 11

We are hitting this again on an upgraded box, which was upgraded from 6.3.z to 6.4. snap 11.

We just have one puppet-class named "generic_1" in that env. puppet class info, has a parameter to search in environment but it doesn't do that.

hammer -v -u admin -p changeme  puppet-class info --name="generic_1" --environment="KT_d9pR4I_Library_PtGKAORQmb_198"
[ERROR 2018-07-09T07:36:58 Exception] Error: Found more than one puppetclass.
Error: Found more than one puppetclass.
[ERROR 2018-07-09T07:36:58 Exception] 

HammerCLIForeman::ResolverError (Found more than one puppetclass.):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.0/lib/hammer_cli_foreman/id_resolver.rb:242:in `pick_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.0/lib/hammer_cli_foreman/id_resolver.rb:292:in `puppetclass_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.0/lib/hammer_cli_foreman/commands.rb:131:in `get_resource_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.0/lib/hammer_cli_foreman/commands.rb:119:in `get_identifier'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.0/lib/hammer_cli_foreman/option_sources/self_param.rb:11:in `get_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/options/option_collector.rb:13:in `block in all_options_raw'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/options/option_collector.rb:12:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/options/option_collector.rb:12:in `inject'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/options/option_collector.rb:12:in `all_options_raw'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/options/option_collector.rb:18:in `all_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/options/option_collector.rb:22:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/abstract.rb:239:in `options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/abstract.rb:42:in `parse'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:62:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/bin/hammer:143:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


[root@qe-sat6-upgrade-rhel7 ~]# hammer -v -u admin -p changeme  puppet-class list --environment="KT_d9pR4I_Library_PtGKAORQmb_198"
---|----------------------------
ID | NAME                       
---|----------------------------
1  | access_insights_client     
4  | foreman_scap_client        
5  | foreman_scap_client::params
97 | generic_1                  
2  | stdlib                     
3  | stdlib::stages             
---|----------------------------

[root@qe-sat6-upgrade-rhel7 ~]# hammer -v -u admin -p changeme  puppet-class info --help
Usage:
    hammer puppet-class info [OPTIONS]

Options:
 --environment ENVIRONMENT_NAME          Environment name
 --environment-id ENVIRONMENT_ID          
 --host HOST_NAME                        Host name
 --host-id HOST_ID                        
 --hostgroup HOSTGROUP_NAME              Hostgroup name
 --hostgroup-id HOSTGROUP_ID              
 --hostgroup-title HOSTGROUP_TITLE       Hostgroup title
 --id ID                                 ID of Puppet class
 --location LOCATION_NAME                Location name
 --location-id LOCATION_ID                
 --location-title LOCATION_TITLE         Location title
 --name NAME                             Puppet class name
 --organization ORGANIZATION_NAME        Organization name
 --organization-id ORGANIZATION_ID       Organization ID
 --organization-title ORGANIZATION_TITLE Organization title
 -h, --help                              Print help

Comment 13 Ondřej Pražák 2018-08-16 10:44:58 UTC
Created redmine issue http://projects.theforeman.org/issues/24633 from this bug

Comment 14 pm-sat@redhat.com 2018-08-31 12:14:51 UTC
Upstream bug assigned to oprazak@redhat.com

Comment 15 pm-sat@redhat.com 2018-08-31 12:14:55 UTC
Upstream bug assigned to oprazak@redhat.com

Comment 16 pm-sat@redhat.com 2018-09-18 12:06:19 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/24633 has been resolved.

Comment 21 errata-xmlrpc 2019-05-14 12:36:46 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-2019:1222


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