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 1109313 - hammer lifecycle-environment list with a not created --name is not working
Summary: hammer lifecycle-environment list with a not created --name is not working
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Martin Bacovsky
QA Contact: sthirugn@redhat.com
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-13 15:51 UTC by Elyézer Rezende
Modified: 2019-09-26 18:12 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-02 14:14:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 6238 0 None None None 2016-04-22 16:11:00 UTC

Description Elyézer Rezende 2014-06-13 15:51:05 UTC
Description of problem:
Hammer is raising an exception when trying to list passing a --name of a lifecycle environment that was not created or have been deleted. The error is not raised when passing a --name of a created lifecycle environment.


Version-Release number of selected component (if applicable):
# hammer --version
hammer (0.1.1)
 * hammer_cli_foreman (0.1.1)
 * hammer_cli_katello (0.0.4)

How reproducible:
Aways

Steps to Reproduce:
1. LANG=en_US hammer -v -u admin -p changeme  --output csv lifecycle-environment list --name=<not_created_name> --organization-id=<org_id>

Actual results:
Error "Error: undefined method `map' for nil:NilClass" is raised

Expected results:
Return a list with no result


Additional info:
# LANG=en_US hammer -v -d -u admin -p changeme  --output csv lifecycle-environment list --name='q2h09tnk' --organization-id='224'
[ INFO 2014-06-13 10:20:07 Init] Initialization of Hammer CLI (0.1.1) has started...
[DEBUG 2014-06-13 10:20:07 Init] Running at ruby 1.8.7-p352
[ INFO 2014-06-13 10:20:07 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2014-06-13 10:20:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2014-06-13 10:20:07 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2014-06-13 10:20:07 Connection] Registered: foreman
[DEBUG 2014-06-13 10:20:07 API] Global headers: {
    "Accept-Language" => "en",
              :accept => "application/json;version=2",
        :content_type => "application/json"
}
[ INFO 2014-06-13 10:20:07 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-13 10:20:07 API] Params: {}
[DEBUG 2014-06-13 10:20:07 API] Headers: {
    :accept => "application/json",
    :params => {}
}
[DEBUG 2014-06-13 10:20:07 API] Response {
    "checksum" => "c1ab9a17632a976fd006a97155bdfbbe"
}
[ INFO 2014-06-13 10:20:08 Modules] Extension module hammer_cli_foreman (0.1.1) loaded
[ INFO 2014-06-13 10:20:08 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2014-06-13 10:20:08 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2014-06-13 10:20:09 Modules] Extension module hammer_cli_katello (0.0.4) loaded
[DEBUG 2014-06-13 10:20:09 Init] Using locale 'en'
[DEBUG 2014-06-13 10:20:09 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-06-13 10:20:09 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-06-13 10:20:09 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-06-13 10:20:09 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_username"=>"admin", "option_password"=>"***", "option_debug"=>true, "option_output"=>"csv"}
[ INFO 2014-06-13 10:20:09 HammerCLIKatello::LifecycleEnvironmentCommand] Called with options: {}
[ INFO 2014-06-13 10:20:09 HammerCLIKatello::LifecycleEnvironmentCommand::ListCommand] Called with options: {"option_name"=>"q2h09tnk", "option_organization_id"=>"224"}
[ INFO 2014-06-13 10:20:09 API] GET /apidoc/apipie_checksum
[DEBUG 2014-06-13 10:20:09 API] Params: {}
[DEBUG 2014-06-13 10:20:09 API] Headers: {
    :accept => "application/json",
    :params => {}
}
[DEBUG 2014-06-13 10:20:09 API] Response {
    "checksum" => "c1ab9a17632a976fd006a97155bdfbbe"
}
[ INFO 2014-06-13 10:20:09 API] GET /katello/api/organizations/224/environments
[DEBUG 2014-06-13 10:20:09 API] Params: {
    "name" => "q2h09tnk"
}
[DEBUG 2014-06-13 10:20:09 API] Headers: {
    :params => {
        "name" => "q2h09tnk"
    }
}
[DEBUG 2014-06-13 10:20:09 API] Response {
        "sort" => {
        "order" => nil,
           "by" => nil
    },
    "per_page" => 20,
     "results" => [],
       "total" => 0,
        "page" => 1,
      "search" => nil,
    "subtotal" => 0
}
[ERROR 2014-06-13 10:20:09 Exception] Error: undefined method `map' for nil:NilClass
Error: undefined method `map' for nil:NilClass
[ERROR 2014-06-13 10:20:09 Exception] 
 
NoMethodError (undefined method `map' for nil:NilClass):
    /usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1490:in `<<'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/output/adapter/csv.rb:155:in `print_collection'
    /usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1077:in `generate'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/output/adapter/csv.rb:194:in `generate'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/output/adapter/csv.rb:154:in `print_collection'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/output/output.rb:27:in `print_collection'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/../abstract.rb:166:in `print_collection'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/./apipie/command.rb:57:in `print_data'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:234:in `retrieve_and_print'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/lib/hammer_cli_foreman/commands.rb:207: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:100
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19

Comment 3 Martin Bacovsky 2014-06-16 14:20:39 UTC
CSV adapter is failing on printing empty collections.

Comment 5 Martin Bacovsky 2014-06-16 15:18:52 UTC
Created redmine issue http://projects.theforeman.org/issues/6238 from this bug

Comment 6 Martin Bacovsky 2014-06-17 11:45:02 UTC
Fixed upstream https://github.com/theforeman/hammer-cli/pull/119

Comment 9 sthirugn@redhat.com 2014-06-19 03:45:45 UTC
Verified. 

# hammer --output csv lifecycle-environment list --name='nonexisting' --organization-id=1
ID,Name,Prior

# hammer lifecycle-environment list --name='nonexisting' --organization-id=1No data.

Version Tested:

* 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.18-1.el6sat.noarch
* foreman-compute-1.6.0.18-1.el6sat.noarch
* foreman-gce-1.6.0.18-1.el6sat.noarch
* foreman-libvirt-1.6.0.18-1.el6sat.noarch
* foreman-ovirt-1.6.0.18-1.el6sat.noarch
* foreman-postgresql-1.6.0.18-1.el6sat.noarch
* foreman-proxy-1.6.0.8-1.el6sat.noarch
* foreman-selinux-1.6.0-4.el6sat.noarch
* foreman-vmware-1.6.0.18-1.el6sat.noarch
* katello-1.5.0-26.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.5-1.el6sat.noarch
* katello-installer-0.0.49-1.el6sat.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* openldap-devel-2.4.23-32.el6_4.1.x86_64
* pulp-katello-0.3-3.el6sat.noarch
* pulp-nodes-common-2.4.0-0.21.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.21.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.21.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.21.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.21.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.21.beta.el6sat.noarch
* pulp-server-2.4.0-0.21.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

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

Comment 11 Bryan Kearney 2014-07-02 14:09:53 UTC
This was delivered in 6.0.3, the Beta version of Satellite 6.0

Comment 12 Bryan Kearney 2014-07-02 14:14:37 UTC
This was delivered in the Satellite 6 Beta (6.0.3)


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