Bug 1122167

Summary: Using hostgroup puppet-classes generates error
Product: Red Hat Satellite Reporter: Og Maciel <omaciel>
Component: HammerAssignee: orabin
Status: CLOSED ERRATA QA Contact: Tazim Kolhar <tkolhar>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: bkearney, cwelton, dcleal, jmontleo, tkolhar
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/7473
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:11:15 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 Og Maciel 2014-07-22 17:08:24 UTC
Description of problem:

Using the 'hostgroup puppet-classes' command via the CLI generates an error:

# hammer -u zumx59 -p s9w3 hostgroup puppet-classes --hostgroup-id 1
Error: Missing options to search puppetclass

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

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.19-1.el6_5.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.9.19-1.el6_5.noarch
* candlepin-tomcat6-0.9.19-1.el6_5.noarch
* elasticsearch-0.90.10-4.el6sat.noarch
* foreman-1.6.0.29-1.el6sat.noarch
* foreman-compute-1.6.0.29-1.el6sat.noarch
* foreman-gce-1.6.0.29-1.el6sat.noarch
* foreman-libvirt-1.6.0.29-1.el6sat.noarch
* foreman-ovirt-1.6.0.29-1.el6sat.noarch
* foreman-postgresql-1.6.0.29-1.el6sat.noarch
* foreman-proxy-1.6.0.21-1.el6sat.noarch
* foreman-selinux-1.6.0-8.el6sat.noarch
* foreman-vmware-1.6.0.29-1.el6sat.noarch
* katello-1.5.0-27.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-installer-0.0.56-1.el6sat.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* pulp-katello-0.3-3.el6sat.noarch
* pulp-nodes-common-2.4.0-0.23.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.23.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.23.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.23.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.23.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.23.beta.el6sat.noarch
* pulp-server-2.4.0-0.23.beta.el6sat.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
* ruby193-rubygem-runcible-1.1.0-2.el6sat.noarch
* rubygem-hammer_cli-0.1.1-10.el6sat.noarch
* rubygem-hammer_cli_foreman-0.1.1-12.el6sat.noarch
* rubygem-hammer_cli_foreman_tasks-0.0.3-3.el6sat.noarch
* rubygem-hammer_cli_katello-0.0.4-8.el6sat.noarch

How reproducible:


Steps to Reproduce:
1. Use the CLI and run the hostgroup puppet-class command
2.
3.

Actual results:

An error is being raised

Expected results:


Additional info:

# hammer -u zumx59 -p s9w3 hostgroup list
---|--------------------------------------------------------------------|-------|------------------|-------------|-------|---------
ID | NAME                                                               | LABEL | OPERATING SYSTEM | ENVIRONMENT | MODEL | ANCESTRY
---|--------------------------------------------------------------------|-------|------------------|-------------|-------|---------
4  | baz                                                                |       |                  |             |       |
2  | ofoo                                                               |       |                  |             |       |
1  | 쥄㣆ꢕ䗀ᖑᆰ뒘礋捖䱣쒀䴮쏩騬橌矄ⱅರ㪷澘쨼 |       |                  |             |       |
3  | 쏩騬橌矄ⱅರ                                                 |       |                  |             |       |
---|--------------------------------------------------------------------|-------|------------------|-------------|-------|---------

# hammer -u zumx59 -p s9w3 hostgroup puppet-classes -h
Usage:
    hammer hostgroup puppet-classes [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
    --order ORDER                 Sort results
    --page PAGE                   paginate results
    --per-page PER_PAGE           number of entries per request
    --search SEARCH               Filter results
    -h, --help                    print help


# hammer -u zumx59 -p s9w3 -v -d hostgroup puppet-classes --hostgroup-id 1
[ INFO 2014-07-22 13:07:32 Init] Initialization of Hammer CLI (0.1.1) has started...
[DEBUG 2014-07-22 13:07:32 Init] Running at ruby 1.8.7-p352
[ INFO 2014-07-22 13:07:32 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2014-07-22 13:07:32 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2014-07-22 13:07:32 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2014-07-22 13:07:33 Connection] Registered: foreman
[DEBUG 2014-07-22 13:07:33 API] Global headers: {
    "Accept-Language" => "en",
        :content_type => "application/json",
              :accept => "application/json;version=2"
}
[ INFO 2014-07-22 13:07:33 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2014-07-22 13:07:33 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2014-07-22 13:07:34 Modules] Extension module hammer_cli_katello (0.0.4) loaded
[ INFO 2014-07-22 13:07:34 Modules] Extension module hammer_cli_foreman (0.1.1) loaded
[DEBUG 2014-07-22 13:07:34 Init] Using locale 'en'
[DEBUG 2014-07-22 13:07:34 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/locale'
[DEBUG 2014-07-22 13:07:34 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/locale'
[DEBUG 2014-07-22 13:07:34 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_katello-0.0.4/locale'
[ INFO 2014-07-22 13:07:34 HammerCLI::MainCommand] Called with options: {"option_password"=>"***", "option_username"=>"zumx59", "option_debug"=>true, "option_verbose"=>true}
[ INFO 2014-07-22 13:07:34 HammerCLIForeman::Hostgroup] Called with options: {}
[ INFO 2014-07-22 13:07:34 HammerCLIForeman::Hostgroup::PuppetClassesCommand] Called with options: {"option_hostgroup_id"=>"1"}
[ERROR 2014-07-22 13:07:34 Exception] Error: Missing options to search puppetclass
Error: Missing options to search puppetclass
[ERROR 2014-07-22 13:07:34 Exception]

HammerCLIForeman::MissingSeachOptions (Missing options to search puppetclass):
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:152:in `search_options'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:120:in `find_resource'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:114:in `get_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/id_resolver.rb:108:in `puppetclass_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:143:in `send'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:143:in `get_resource_id'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:132:in `get_identifier'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/hostgroup.rb:103:in `request_params'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:42:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:164:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:198:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/hostgroup.rb:98:in `send_request'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:244:in `retrieve_and_print'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:231:in `browse_collection'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:216:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/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:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/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:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/bin/hammer:102
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

Comment 2 Dominic Cleal 2014-09-16 14:42:45 UTC
Created redmine issue http://projects.theforeman.org/issues/7473 from this bug

Comment 3 Bryan Kearney 2015-02-12 11:02:36 UTC
Upstream bug assigned to orabin

Comment 4 Bryan Kearney 2015-02-12 11:02:37 UTC
Upstream bug assigned to orabin

Comment 5 Bryan Kearney 2015-02-26 13:02:41 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/7473 has been closed
-------------
Ori Rabin
Applied in changeset commit:hammer-cli-foreman|5cfdc4ddb220de20ede03d31ba9093799011b0e3.

Comment 8 Tazim Kolhar 2015-03-16 10:08:15 UTC
VERIFIED :

# rpm -qa | grep foreman
rubygem-hammer_cli_foreman_tasks-0.0.3.3-1.el6_6sat.noarch
foreman-proxy-1.7.2.3-1.el6_6sat.noarch
foreman-ovirt-1.7.2.10-1.el6_6sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.1-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.5-1.el6_6sat.noarch
ruby193-rubygem-foreman_abrt-0.0.5-2.el6_6sat.noarch
foreman-compute-1.7.2.10-1.el6_6sat.noarch
foreman-libvirt-1.7.2.10-1.el6_6sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.6-1.el6_6sat.noarch
rubygem-hammer_cli_foreman-0.1.4.6-1.el6_6sat.noarch
foreman-selinux-1.7.2.8-1.el6_6sat.noarch
foreman-gce-1.7.2.10-1.el6_6sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.3-1.el6_6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.0.9-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-client-1.0-1.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-client-1.0-1.noarch
foreman-debug-1.7.2.10-1.el6_6sat.noarch
foreman-vmware-1.7.2.10-1.el6_6sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.8-1.el6_6sat.noarch
qe-sat6-rhel66.usersys.redhat.com-foreman-proxy-1.0-2.noarch
foreman-1.7.2.10-1.el6_6sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el6_6sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.2-1.el6_6sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el6_6sat.noarch
foreman-postgresql-1.7.2.10-1.el6_6sat.noarch

#  hammer -u admin -p changeme hostgroup list
/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 | NAME                                                                             | TITLE                                                                            | OPERATING SYSTEM | ENVIRONMENT                           | MODEL
---|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------|------------------|---------------------------------------|------
9  | 13265898251308777                                                                | 13265898251308777                                                                |                  |                                       |      
10 | 451323257684239646                                                               | 451323257684239646                                                               |                  |                                       |      
1  | a00nv6CiWv                                                                       | a00nv6CiWv                                                                       |                  | KT_oy4uhKJAV0_CXI1z7ivGx_KJjTjlvPZK_9 |      
2  | aAmWrZ                                                                           | aAmWrZ                                                                           |                  |                                       |      
7  | ãøÓàÒñëìïø                                                             | ãøÓàÒñëìïø                                                             |                  |                                       |      
6  | êÂÑãØç                                                                     | êÂÑãØç                                                                     |                  |                                       |      
8  | <i>pgufMhxxgAIkpuEeZhIByb</i>                                                    | <i>pgufMhxxgAIkpuEeZhIByb</i>                                                    |                  |                                       |      
4  | <noscript>qFqJ</noscript>                                                        | <noscript>qFqJ</noscript>                                                        |                  |                                       |      
3  | sru5Ep                                                                           | sru5Ep                                                                           |                  |                                       |      
11 | 岜歚瑕呉觯廂緞鶜逼枈怀荏鴂心熖複廆卬欥猞了蹠袟瑿跢��... | 岜歚瑕呉觯廂緞鶜逼枈怀荏鴂心熖複廆卬欥猞了蹠袟瑿跢��... |                  |                                       |      
---|----------------------------------------------------------------------------------|-------------------------------------------------------------------------


# hammer -u admin -p changeme -v -d hostgroup puppet-classes --hostgroup-id 7
[ INFO 2015-03-16 06:06:44 Init] Initialization of Hammer CLI (0.1.4) has started...
[DEBUG 2015-03-16 06:06:44 Init] Running at ruby 1.8.7-p374
[ INFO 2015-03-16 06:06:44 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2015-03-16 06:06:44 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2015-03-16 06:06:44 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2015-03-16 06:06:44 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded
[ INFO 2015-03-16 06:06:44 Init] Configuration from the file /etc/hammer/cli.modules.d/gutterball.yml has been loaded
[ INFO 2015-03-16 06:06:44 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2015-03-16 06:06:44 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
/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
[DEBUG 2015-03-16 06:06:45 Connection] Registered: foreman
[DEBUG 2015-03-16 06:06:45 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[ INFO 2015-03-16 06:06:45 Modules] Extension module hammer_cli_foreman (0.1.4.6) loaded
[ INFO 2015-03-16 06:06:45 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.2.5) loaded
[ INFO 2015-03-16 06:06:45 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2015-03-16 06:06:45 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2015-03-16 06:06:45 Modules] Extension module hammer_cli_import (0.10.6.3) loaded
[ INFO 2015-03-16 06:06:45 Modules] Extension module hammer_cli_katello (0.0.7.3) loaded
[DEBUG 2015-03-16 06:06:45 Init] Using locale 'en'
[DEBUG 2015-03-16 06:06:45 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/locale'
[DEBUG 2015-03-16 06:06:45 Init] 'mo' files for locale domain 'hammer-cli@system' loaded from '/usr/share/locale'
[DEBUG 2015-03-16 06:06:45 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.4.6/locale'
[DEBUG 2015-03-16 06:06:45 Init] 'mo' files for locale domain 'hammer-cli-foreman@system' loaded from '/usr/share/locale'
[DEBUG 2015-03-16 06:06:45 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_katello-0.0.7.3/locale'
[ INFO 2015-03-16 06:06:45 HammerCLI::MainCommand] Called with options: {"option_password"=>"***", "option_debug"=>true, "option_verbose"=>true, "option_username"=>"admin"}
[ INFO 2015-03-16 06:06:45 HammerCLIForeman::Hostgroup] Called with options: {}
[ INFO 2015-03-16 06:06:45 HammerCLIForeman::Hostgroup::PuppetClassesCommand] Called with options: {"option_hostgroup_id"=>"7"}
[ INFO 2015-03-16 06:06:45 API] GET /api/hostgroups/7/puppetclasses
[DEBUG 2015-03-16 06:06:45 API] Params: {
    "per_page" => 20,
        "page" => 1
}
[DEBUG 2015-03-16 06:06:45 API] Headers: {
    :params => {
        "per_page" => 20,
            "page" => 1
    }
}
[DEBUG 2015-03-16 06:06:45 API] Response: {
      "search" => nil,
    "per_page" => 20,
     "results" => {},
        "sort" => {
        "order" => nil,
           "by" => nil
    },
    "subtotal" => 0,
       "total" => 0,
        "page" => 1
}
[DEBUG 2015-03-16 06:06:45 API] Response headers: {
                 :status => "200 OK",
             :connection => "close",
    :foreman_api_version => "2",
        :apipie_checksum => "6e353ce97408b6b48e36d449b69c2155",
           :x_rack_cache => "miss",
      :transfer_encoding => "chunked",
           :x_powered_by => "Phusion Passenger 4.0.18",
                   :etag => "\"d83335b9f6700942ad3fe533b6483316\"",
        :x_ua_compatible => "IE=Edge,chrome=1",
           :x_request_id => "0818d9d82502634ad27860d6449375f4",
                   :date => "Mon, 16 Mar 2015 10:06:45 GMT",
           :content_type => "application/json; charset=utf-8",
             :set_cookie => [
        [0] "_session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJTY0ZDg1ZDA5MWM2NmY2ZmE0YmZmNWY1YThkOGE4NmU3BjsAVEkiC2xvY2FsZQY7AEYiB2Vu--31829e01d88891a733acaa65555019f606259856; path=/; HttpOnly"
    ],
              :x_runtime => "0.055107",
                 :server => "Apache/2.2.15 (Red Hat)",
        :foreman_version => "1.7.2",
          :cache_control => "must-revalidate, private, max-age=0"
}
---|-----
ID | NAME
---|-----

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

Comment 10 errata-xmlrpc 2015-08-12 05:11:15 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