Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1354544 - [hammer] Hostgroup create with architecture name raises misleading error: found more than one architecture
Summary: [hammer] Hostgroup create with architecture name raises misleading error: fou...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Host Group
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high vote
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-11 14:06 UTC by Sachin Ghai
Modified: 2016-12-20 19:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-20 19:35:42 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Sachin Ghai 2016-07-11 14:06:51 UTC
Description of problem: Hostgroup create with architecture name raises misleading error: found more than one architecture

However, with 'arch-id' I was able to create hostgroup

 ~]# hammer -u admin -p changeme hostgroup create --name test12342 --architecture=x86_64 --organizations='Default Organization' 
Could not create the hostgroup:
  Error: found more than one architecture


 ~]# hammer -u admin -p changeme architecture list
---|-------
ID | NAME  
---|-------
2  | i386  
1  | x86_64
---|-------


[root@qe-sat6-upgrade-rhel7 ~]# hammer -u admin -p changeme hostgroup create --name test12342 --architecture-id=1 --organizations='Default Organization' 
Hostgroup created



Version-Release number of selected component (if applicable):
sat62 GA snap19.1

How reproducible:


Steps to Reproduce:
1.hammer -u admin -p changeme hostgroup create --name test12342 --architecture=x86_64 --organizations='Default Organization' 
2.
3.

Actual results:


Expected results:


Additional info:
[ INFO 2016-07-11 10:01:52 API] GET /api/architectures
[DEBUG 2016-07-11 10:01:52 API] Params: {
    "name" => "x86_64"
}
[DEBUG 2016-07-11 10:01:52 API] Headers: {
    :params => {
        "name" => "x86_64"
    }
}
[DEBUG 2016-07-11 10:01:52 API] Response: {
       "total" => 2,
    "subtotal" => 2,
        "page" => 1,
    "per_page" => 20,
      "search" => nil,
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => [
        [0] {
            "created_at" => "2016-03-31 12:24:04 UTC",
            "updated_at" => "2016-03-31 12:24:04 UTC",
                  "name" => "i386",
                    "id" => 2
        },
        [1] {
            "created_at" => "2016-03-31 12:24:04 UTC",
            "updated_at" => "2016-03-31 12:24:04 UTC",
                  "name" => "x86_64",
                    "id" => 1
        }
    ]
}
[DEBUG 2016-07-11 10:01:52 API] Response headers: {
                      :date => "Mon, 11 Jul 2016 14:01:52 GMT",
                    :server => "Apache/2.4.6 (Red Hat Enterprise Linux)",
           :x_frame_options => "SAMEORIGIN",
          :x_xss_protection => "1; mode=block",
    :x_content_type_options => "nosniff",
           :foreman_version => "1.11.0.44",
       :foreman_api_version => "2",
           :apipie_checksum => "fc61a316a7d3725e6ce2f2ff9f6784fb",
             :cache_control => "max-age=0, private, must-revalidate",
              :x_request_id => "7c3076b9-a087-41eb-8de5-e676405ffe3f",
                 :x_runtime => "0.087598",
              :x_powered_by => "Phusion Passenger 4.0.18",
                :set_cookie => [
        [0] "_session_id=8eed3e78c37045063eb5430344ebac54; path=/; secure; HttpOnly"
    ],
                      :etag => "\"52815bbcb36ca2352d24383e451bdd13-gzip\"",
                    :status => "200 OK",
                      :vary => "Accept-Encoding",
          :content_encoding => "gzip",
            :content_length => "181",
              :content_type => "application/json; charset=utf-8"
}
[ERROR 2016-07-11 10:01:52 Exception] Error: found more than one architecture
Could not create the hostgroup:
  Error: found more than one architecture
[ERROR 2016-07-11 10:01:52 Exception] 

HammerCLIForeman::ResolverError (found more than one architecture):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/id_resolver.rb:209:in `pick_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/id_resolver.rb:168:in `find_resource'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/id_resolver.rb:143:in `get_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/id_resolver.rb:133:in `block (2 levels) in define_id_finders'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/commands.rb:154:in `get_resource_id'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/commands.rb:223:in `block in customized_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/commands.rb:220:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/commands.rb:220:in `customized_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/commands.rb:244:in `request_params'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/hostgroup.rb:28:in `request_params'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.11/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/lib/hammer_cli_foreman/commands.rb:190:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.11/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.11/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.11/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.11/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.11/bin/hammer:125:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 2 Tomer Brisker 2016-12-20 19:35:42 UTC
Seems to be fixed in Satellite 6.2.6: 

# hammer -u admin -p changeme hostgroup create --name test12342 --architecture=x86_64 --organizations='Test_Org'
Hostgroup created

Closing this, feel free to reopen if issue persists.


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