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 1084722

Summary: Cannot get information from system by its ID
Product: Red Hat Satellite Reporter: Og Maciel <omaciel>
Component: HammerAssignee: Dustin Tsang <dtsang>
Status: CLOSED CURRENTRELEASE QA Contact: Og Maciel <omaciel>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: bkearney, dtsang, mmccune, sghai, tkolhar
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/5613
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-02 14:07:47 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-04-05 23:37:39 UTC
Description of problem:

Trying to fetch the information from an existing system using the CLI generates a stacktrace. Using the system's UUID however works

[root@qetello01 ~]# hammer -v --csv system create --name=foobar --organization-id='ACME_Corporation'
Message,Id,Name
System created,2,foobar


[root@qetello01 ~]# hammer -v --csv system list --organization-id='ACME_Corporation'
ID,Name
f69e0a84-5cb7-4b0a-ab7a-3da71f619ab2,foobar
33a362dd-a1be-467d-ab91-a85ba17dddd9,foo

[root@qetello01 ~]# hammer -v --csv system info --id=2
[ERROR 2014-04-05 19:31:02 Exception] Error: 400 Bad Request
Error: 400 Bad Request
[ERROR 2014-04-05 19:31:02 Exception]

RestClient::BadRequest (400 Bad Request):
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:48:in `return!'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:220:in `process_result'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:169:in `transmit'
    /usr/lib/ruby/1.8/net/http.rb:543:in `start'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:54:in `get'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.6/lib/apipie_bindings/api.rb:196:in `send'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.6/lib/apipie_bindings/api.rb:196:in `http_call'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.6/lib/apipie_bindings/api.rb:155:in `call'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.6/lib/apipie_bindings/resource.rb:14:in `call'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/read_command.rb:19:in `retrieve_data'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.0/lib/hammer_cli_foreman/commands.rb:165:in `retrieve_data'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/read_command.rb:8: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.0/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.0/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.0/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.0/bin/hammer:100
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

[root@qetello01 ~]# hammer -v system info --id f69e0a84-5cb7-4b0a-ab7a-3da71f619ab2
Name:                  foobar
ID:                    2
UUID:                  f69e0a84-5cb7-4b0a-ab7a-3da71f619ab2
Description:           Initial Registration Params
Location:              None
Lifecycle Environment: Library
Content View:          Default Organization View
Entitlement Status:    valid
Release Version:
Autoheal:              true

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

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.8.33-1.el6.noarch
* candlepin-selinux-0.8.33-1.el6.noarch
* candlepin-tomcat6-0.8.33-1.el6.noarch
* elasticsearch-0.90.10-4.el6.noarch
* foreman-1.5.0-0.develop.201404041450git869bbff.el6.noarch
* foreman-compute-1.5.0-0.develop.201404041450git869bbff.el6.noarch
* foreman-libvirt-1.5.0-0.develop.201404041450git869bbff.el6.noarch
* foreman-postgresql-1.5.0-0.develop.201404041450git869bbff.el6.noarch
* foreman-proxy-1.5.0-0.develop.201404021018git3824d18.el6.noarch
* foreman-release-1.5.0-0.develop.201404041450git869bbff.el6.noarch
* foreman-selinux-1.5.0-0.develop.201402261344git2f43f94.el6.noarch
* katello-1.5.0-14.201404041741git6e31336.el6.noarch
* katello-apache-1.0-1.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.2-1.git.1.edab2c4.el6.noarch
* katello-installer-0.0.19-1.201404021805git6ac0e9a.el6.noarch
* katello-repos-1.5.1-1.git.14.0868bd1.el6.noarch
* openldap-2.4.23-31.el6.x86_64
* pulp-katello-plugins-0.2-1.el6.noarch
* pulp-nodes-common-2.3.1-1.el6.noarch
* pulp-nodes-parent-2.3.1-1.el6.noarch
* pulp-puppet-plugins-2.3.1-1.el6.noarch
* pulp-rpm-plugins-2.3.1-1.el6.noarch
* pulp-selinux-2.3.1-1.el6.noarch
* pulp-server-2.3.1-1.el6.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-ldap_fluff-0.2.2-2.el6.noarch
* ruby193-rubygem-net-ldap-0.3.1-1.el6.noarch
* ruby193-rubygem-runcible-1.0.8-1.el6.noarch
* rubygem-hammer_cli-0.1.0-1.201404021454git4336787.git.0.070e774.el6.noarch
* rubygem-hammer_cli_foreman-0.1.0-1.201404011518git2abbfd3.git.0.37211af.el6.noarch
* rubygem-hammer_cli_foreman_tasks-0.0.2-1.201403312028gitdf60592.git.0.b4ebd5a.el6.noarch
* rubygem-hammer_cli_katello-0.0.3-1.201404041801gitd850831.git.0.cf29b20.el6.noarch

How reproducible:


Steps to Reproduce:
1. Create a new system using the hammer cli
2. Try to get the system information via hammer cli using the system's id
3.

Actual results:

Stacktrace

Expected results:


Additional info:

Comment 1 Og Maciel 2014-04-05 23:48:26 UTC
Also affects hammer system tasks

[root@qetello01 ~]# hammer -v system tasks --id 2
[ERROR 2014-04-05 19:47:06 Exception] Error: 400 Bad Request
Error: 400 Bad Request
[ERROR 2014-04-05 19:47:06 Exception]

RestClient::BadRequest (400 Bad Request):
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:48:in `return!'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:220:in `process_result'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:169:in `transmit'
    /usr/lib/ruby/1.8/net/http.rb:543:in `start'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute'
    /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:54:in `get'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.6/lib/apipie_bindings/api.rb:196:in `send'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.6/lib/apipie_bindings/api.rb:196:in `http_call'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.6/lib/apipie_bindings/api.rb:155:in `call'
    /usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.6/lib/apipie_bindings/resource.rb:14:in `call'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/read_command.rb:19:in `retrieve_data'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.0/lib/hammer_cli_foreman/commands.rb:95:in `retrieve_data'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.0/lib/hammer_cli_foreman/commands.rb:140:in `retrieve_and_print'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.0/lib/hammer_cli_foreman/commands.rb:115: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.0/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.0/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.0/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.0/bin/hammer:100
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19
[root@qetello01 ~]# hammer -v system tasks --id f69e0a84-5cb7-4b0a-ab7a-3da71f619ab2
No data.

Comment 2 Og Maciel 2014-04-05 23:51:11 UTC
Also affects hammer system update

[root@qetello01 ~]# hammer system update --id 2 --name baz
Could not update system:
  Error: 400 Bad Request
[root@qetello01 ~]# hammer system update --id f69e0a84-5cb7-4b0a-ab7a-3da71f619ab2 --name baz
System updated

Comment 3 Og Maciel 2014-04-06 00:03:07 UTC
Delete also is affected

[root@qetello01 ~]# hammer system delete --id 2
Could not delete system:
  Error: 400 Bad Request
[root@qetello01 ~]# hammer system delete --id f69e0a84-5cb7-4b0a-ab7a-3da71f619ab2
System deleted

Comment 5 Dustin Tsang 2014-05-07 15:58:46 UTC
redmine url: http://projects.theforeman.org/issues/5613

Comment 7 Dustin Tsang 2014-05-14 01:33:03 UTC
Previous pull request is no sufficient by itself since it just provides the user with better insight on the command failures.

Comment 9 Dustin Tsang 2014-05-14 14:29:03 UTC
Pull request that addresses #comment8:
https://github.com/Katello/hammer-cli-katello/pull/166

Comment 11 Tazim Kolhar 2014-05-20 07:17:24 UTC
There is no sub command as system but there is sub command 

]# hammer  host --help
Usage:
    hammer host [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:
    SUBCOMMAND                    subcommand
    [ARG] ...                     subcommand arguments

Subcommands:
    create                        Create a host.
    delete                        Delete an host.
    delete-parameter              Delete parameter for a host.
    facts                         List all fact values.
    info                          Show a host.
    list                          List all hosts.
    puppet-classes                List all puppetclasses.
    puppetrun                     Force a puppet run on the agent.
    reboot                        Reboot a host
    reports                       List all reports.
    sc-params                     List all smart class parameters
    set-parameter                 Create or update parameter for a host.
    start                         Power a host on
    status                        Get status of host
    stop                          Power a host off
    update                        Update a host.

Options:
    -h, --help                    print help

Please let me know if system implies host here

Thanks in advance

Comment 12 Sachin Ghai 2014-05-20 07:49:51 UTC
@Tazim: FYI...In recent composes, 'system' is renamed to 'content-host'.

Please try:

hammer content-host --help.

Comment 13 Tazim Kolhar 2014-05-22 09:46:46 UTC
Failed QA

# hammer content-host info --organization ACME_Corporation --id 2
Error: 400 Bad Reques

Comment 14 Og Maciel 2014-05-22 19:25:05 UTC
2014-05-22 15:22:12 - robottelo - DEBUG - Running test TestContentHost/test_positive_create_1_1___name___u_CEshMJfbFtCkkQV__
2014-05-22 15:22:12 - robottelo - DEBUG - >>> LANG=en_US hammer -v -u admin -p changeme  lifecycle-environment info --name='Library' --organization-id='115'
2014-05-22 15:22:16 - robottelo - DEBUG - <<< [u'ID:                          128', u'Name:                        Library', u'Label:                       Library', u'Description:                 ', u'Organization:                kgprw7so', u'Library:                     true', u'Prior Lifecycle Environment:', u'', u'']
2014-05-22 15:22:16 - robottelo - DEBUG - >>> LANG=en_US hammer -v -u admin -p changeme  --output csv content-view list --organization-id='115'
2014-05-22 15:22:20 - robottelo - DEBUG - <<< [u'Content View ID,Name,Label,Composite,Repository IDs', u'122,Default Organization View,Default_Organization_View,,', u'124,uDMBZfWVEB,uDMBZfWVEB,,', u'']
2014-05-22 15:22:20 - robottelo - DEBUG - >>> LANG=en_US hammer -v -u admin -p changeme  --output csv content-host create --description='agPqvsTbZUKWAHUULgUU' --content-view-id='122' --organization-id='115' --environment-id='128' --name='CEshMJfbFtCkkQV'
2014-05-22 15:22:27 - robottelo - DEBUG - <<< [u'Name,ID,Description,Location,Lifecycle Environment,Content View,Entitlement Status,Release Version,Autoheal', u'CEshMJfbFtCkkQV,f09db333-c11c-47de-ab98-26c3e4208141,agPqvsTbZUKWAHUULgUU,None,Library,Default Organization View,valid,,true', u'Message,Id,Name', u'Content host created,2,CEshMJfbFtCkkQV', u'']
2014-05-22 15:22:27 - robottelo - DEBUG - >>> LANG=en_US hammer -v -u admin -p changeme  content-host info --id='f09db333-c11c-47de-ab98-26c3e4208141'
2014-05-22 15:22:32 - robottelo - DEBUG - <<< [u'Name:                  CEshMJfbFtCkkQV', u'ID:                    f09db333-c11c-47de-ab98-26c3e4208141', u'Description:           agPqvsTbZUKWAHUULgUU', u'Location:              None', u'Lifecycle Environment: Library', u'Content View:          Default Organization View', u'Entitlement Status:    valid', u'Release Version:       ', u'Autoheal:              true', u'', u'']
2014-05-22 15:22:37 - robottelo - DEBUG - >>> LANG=en_US hammer -v -u admin -p changeme  content-host info --id='f09db333-c11c-47de-ab98-26c3e4208141'
2014-05-22 15:22:41 - robottelo - DEBUG - <<< [u'Name:                  CEshMJfbFtCkkQV', u'ID:                    f09db333-c11c-47de-ab98-26c3e4208141', u'Description:           agPqvsTbZUKWAHUULgUU', u'Location:              None', u'Lifecycle Environment: Library', u'Content View:          Default Organization View', u'Entitlement Status:    valid', u'Release Version:       ', u'Autoheal:              true', u'', u'']

Comment 15 Og Maciel 2014-05-22 19:25:46 UTC
Verified:
* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.7-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.7-1.el6_5.noarch
* candlepin-tomcat6-0.9.7-1.el6_5.noarch
* elasticsearch-0.90.10-4.el6sat.noarch
* foreman-1.6.0.9-1.el6sat.noarch
* foreman-compute-1.6.0.9-1.el6sat.noarch
* foreman-gce-1.6.0.9-1.el6sat.noarch
* foreman-libvirt-1.6.0.9-1.el6sat.noarch
* foreman-ovirt-1.6.0.9-1.el6sat.noarch
* foreman-postgresql-1.6.0.9-1.el6sat.noarch
* foreman-proxy-1.6.0.6-1.el6sat.noarch
* foreman-selinux-1.6.0-2.el6sat.noarch
* foreman-vmware-1.6.0.9-1.el6sat.noarch
* katello-1.5.0-24.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.5-1.el6sat.noarch
* katello-installer-0.0.41-1.el6sat.noarch
* openldap-2.4.23-31.el6.x86_64
* pulp-katello-plugins-0.3-1.el6sat.noarch
* pulp-nodes-common-2.4.0-0.18.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.18.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.18.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.18.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.18.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.18.beta.el6sat.noarch
* pulp-server-2.4.0-0.18.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.0-13.el6sat.noarch
* rubygem-hammer_cli_foreman-0.1.0-13.el6sat.noarch
* rubygem-hammer_cli_foreman_tasks-0.0.2-6.el6sat.noarch
* rubygem-hammer_cli_katello-0.0.3-24.el6sat.noarch

Comment 16 Bryan Kearney 2014-07-02 14:07:47 UTC
This was delivered with 6.0.3, which is the Satellite 6 Beta.