Bug #6238
closedhammer lifecycle-environment list with a not created --name is not working
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1109313
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.
- 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
- 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
Updated by Martin Bacovsky over 10 years ago
- Category set to Hammer core
- Status changed from New to Ready For Testing
- Target version set to 1.8.1
Updated by Anonymous over 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset fcc7a42765ddf531ce7cba155f909d33bc3c8d2a.