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.
Description of problem:
When running:
hammer> csv content-hosts --organization "Default Organization" --export
We get the result: Error: undefined method `[]' for nil:NilClass
Version-Release number of selected component (if applicable):
Satellite 6.2.4
How reproducible:
100%
Steps to Reproduce:
1. Run # hammer -u admin -p password csv content-hosts --organization "Default Organization" --export
Actual results:
Error: undefined method `[]' for nil:NilClass
Expected results:
CSV Output of header:
Name,Organization,Environment,Content View,Host Collections,Virtual,Host,OS,Arch,Sockets,RAM,Cores,SLA,Products,Subscriptions
And all hosts data from these facts.
Additional info:
Debug output of attempt:
[root@sat62 hammer]# hammer -d csv content-hosts --organization "Default Organization" --export
[ INFO 2016-11-29 20:35:07 Init] Initialization of Hammer CLI (0.5.1.11) has started...
[DEBUG 2016-11-29 20:35:07 Init] Running at ruby 2.2.2-p95
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/csv.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_core.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_katello.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_remote_execution.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2016-11-29 20:35:07 Connection] Registered: foreman
[DEBUG 2016-11-29 20:35:07 API] Global headers: {
:content_type => "application/json",
:accept => "application/json;version=2",
"Accept-Language" => "en"
}
[DEBUG 2016-11-29 20:35:07 API] Follow redirects: never
[ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_foreman (0.5.1.9) loaded
[ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_foreman_admin (0.0.5) loaded
[ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3.3) loaded
[ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_foreman_discovery (0.0.2.3) loaded
[ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_import (0.11.2) loaded
[ INFO 2016-11-29 20:35:07 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2016-11-29 20:35:07 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2016-11-29 20:35:08 Modules] Extension module hammer_cli_katello (0.0.22.26) loaded
[DEBUG 2016-11-29 20:35:08 Init] Using locale 'en'
[DEBUG 2016-11-29 20:35:08 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.11/locale'
[DEBUG 2016-11-29 20:35:08 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/locale'
[DEBUG 2016-11-29 20:35:08 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.6/locale'
[DEBUG 2016-11-29 20:35:08 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.26/locale'
[ INFO 2016-11-29 20:35:08 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[ INFO 2016-11-29 20:35:08 HammerCLICsv::CsvCommand] Called with options: {}
[ INFO 2016-11-29 20:35:08 HammerCLICsv::CsvCommand::ContentHostsCommand] Called with options: {"option_threads"=>1, "option_export"=>true, "option_organization"=>"Default Organization"}
Name,Organization,Environment,Content View,Host Collections,Virtual,Host,OS,Arch,Sockets,RAM,Cores,SLA,Products,Subscriptions
[ERROR 2016-11-29 20:35:16 Exception] Error: undefined method `[]' for nil:NilClass
Error: undefined method `[]' for nil:NilClass
[ERROR 2016-11-29 20:35:16 Exception]
NoMethodError (undefined method `[]' for nil:NilClass):
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:374:in `block (2 levels) in iterate_hosts'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:369:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:369:in `block in iterate_hosts'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:363:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:363:in `iterate_hosts'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:74:in `export_all'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:36:in `export'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/base.rb:85:in `block in execute'
/opt/rh/rh-ruby22/root/usr/share/ruby/csv.rb:1048:in `instance'
/opt/rh/rh-ruby22/root/usr/share/ruby/csv.rb:2320:in `CSV'
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/base.rb:84: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>'
Description of problem: When running: hammer> csv content-hosts --organization "Default Organization" --export We get the result: Error: undefined method `[]' for nil:NilClass Version-Release number of selected component (if applicable): Satellite 6.2.4 How reproducible: 100% Steps to Reproduce: 1. Run # hammer -u admin -p password csv content-hosts --organization "Default Organization" --export Actual results: Error: undefined method `[]' for nil:NilClass Expected results: CSV Output of header: Name,Organization,Environment,Content View,Host Collections,Virtual,Host,OS,Arch,Sockets,RAM,Cores,SLA,Products,Subscriptions And all hosts data from these facts. Additional info: Debug output of attempt: [root@sat62 hammer]# hammer -d csv content-hosts --organization "Default Organization" --export [ INFO 2016-11-29 20:35:07 Init] Initialization of Hammer CLI (0.5.1.11) has started... [DEBUG 2016-11-29 20:35:07 Init] Running at ruby 2.2.2-p95 [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/csv.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_core.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_katello.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_remote_execution.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded [ INFO 2016-11-29 20:35:07 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded [DEBUG 2016-11-29 20:35:07 Connection] Registered: foreman [DEBUG 2016-11-29 20:35:07 API] Global headers: { :content_type => "application/json", :accept => "application/json;version=2", "Accept-Language" => "en" } [DEBUG 2016-11-29 20:35:07 API] Follow redirects: never [ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_foreman (0.5.1.9) loaded [ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_foreman_admin (0.0.5) loaded [ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3.3) loaded [ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_foreman_discovery (0.0.2.3) loaded [ INFO 2016-11-29 20:35:07 Modules] Extension module hammer_cli_import (0.11.2) loaded [ INFO 2016-11-29 20:35:07 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed. [ INFO 2016-11-29 20:35:07 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created. [ INFO 2016-11-29 20:35:08 Modules] Extension module hammer_cli_katello (0.0.22.26) loaded [DEBUG 2016-11-29 20:35:08 Init] Using locale 'en' [DEBUG 2016-11-29 20:35:08 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.11/locale' [DEBUG 2016-11-29 20:35:08 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.9/locale' [DEBUG 2016-11-29 20:35:08 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.6/locale' [DEBUG 2016-11-29 20:35:08 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.26/locale' [ INFO 2016-11-29 20:35:08 HammerCLI::MainCommand] Called with options: {"option_debug"=>true} [ INFO 2016-11-29 20:35:08 HammerCLICsv::CsvCommand] Called with options: {} [ INFO 2016-11-29 20:35:08 HammerCLICsv::CsvCommand::ContentHostsCommand] Called with options: {"option_threads"=>1, "option_export"=>true, "option_organization"=>"Default Organization"} Name,Organization,Environment,Content View,Host Collections,Virtual,Host,OS,Arch,Sockets,RAM,Cores,SLA,Products,Subscriptions [ERROR 2016-11-29 20:35:16 Exception] Error: undefined method `[]' for nil:NilClass Error: undefined method `[]' for nil:NilClass [ERROR 2016-11-29 20:35:16 Exception] NoMethodError (undefined method `[]' for nil:NilClass): /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:374:in `block (2 levels) in iterate_hosts' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:369:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:369:in `block in iterate_hosts' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:363:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:363:in `iterate_hosts' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:74:in `export_all' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/content_hosts.rb:36:in `export' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/base.rb:85:in `block in execute' /opt/rh/rh-ruby22/root/usr/share/ruby/csv.rb:1048:in `instance' /opt/rh/rh-ruby22/root/usr/share/ruby/csv.rb:2320:in `CSV' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.1.0/lib/hammer_cli_csv/base.rb:84: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>'