Bug 1399884 - hammer csv content-hosts produces Error: undefined method `[]' for nil:NilClass
Summary: hammer csv content-hosts produces Error: undefined method `[]' for nil:NilClass
Keywords:
Status: CLOSED DUPLICATE of bug 1394218
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.2.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-30 01:39 UTC by Craig Donnelly
Modified: 2016-11-30 15:32 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-30 15:32:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Craig Donnelly 2016-11-30 01:39:09 UTC
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>'

Comment 1 Marek Hulan 2016-11-30 12:59:03 UTC
How is that different from https://bugzilla.redhat.com/show_bug.cgi?id=1394218 ?

Comment 2 Craig Donnelly 2016-11-30 15:31:46 UTC
It does not appear to be any different, I will close this one out. (I searched, I swear!)

Comment 3 Craig Donnelly 2016-11-30 15:32:35 UTC

*** This bug has been marked as a duplicate of bug 1394218 ***


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