Project

General

Profile

Actions

Bug #4531

closed

hammer - subnet info in csv mode errors out

Added by Stephan Dollberg about 10 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

Running

hammer --csv subnet info --id YOUR_ID

gives the error

Error: no implicit conversion of Symbol into Integer

Verbose error print is:

[user@host shelldir]$ hammer -v --csv subnet info --id 1
[ INFO 2014-03-03 18:34:33 Init] Initialization of Hammer CLI (0.0.18) has started...
[ INFO 2014-03-03 18:34:33 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2014-03-03 18:34:34 Modules] Extension module hammer_cli_foreman (0.0.18) loaded
[ INFO 2014-03-03 18:34:34 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true}
[ INFO 2014-03-03 18:34:34 HammerCLIForeman::Subnet] Called with options: {}
[ INFO 2014-03-03 18:34:34 HammerCLIForeman::Subnet::InfoCommand] Called with options: {"option_id"=>"1"}
[DEBUG 2014-03-03 18:34:34 Connection] Registered: foreman_Subnet
[DEBUG 2014-03-03 18:34:34 ForemanApi::Resources::Subnet] Calling 'show' with params {
"id" => "1"
}
[DEBUG 2014-03-03 18:34:34 ForemanApi::Resources::Subnet] Method 'show' responded with {
"id" => 1,
"name" => "asdf",
"network" => "192.168.128.0",
"mask" => "255.255.255.0",
"priority" => nil,
"vlanid" => "1",
"gateway" => "192.168.128.1",
"dns_primary" => "192.168.128.1",
"dns_secondary" => "192.168.128.1",
"from" => "192.168.128.2",
"to" => "192.168.128.100",
"domain_ids" => [
[0] 1
],
"dns_id" => nil,
"dhcp_id" => nil,
"tftp_id" => nil,
"cidr" => 24,
"dhcp" => nil,
"tftp" => nil,
"dns" => nil
}
[DEBUG 2014-03-03 18:34:34 HammerCLIForeman::Subnet::InfoCommand] Retrieved data: {
"id" => 1,
"name" => "asdf",
"network" => "192.168.128.0",
"mask" => "255.255.255.0",
"priority" => nil,
"vlanid" => "1",
"gateway" => "192.168.128.1",
"dns_primary" => "192.168.128.1",
"dns_secondary" => "192.168.128.1",
"from" => "192.168.128.2",
"to" => "192.168.128.100",
"domain_ids" => [
[0] 1
],
"dns_id" => nil,
"dhcp_id" => nil,
"tftp_id" => nil,
"cidr" => 24,
"dhcp" => nil,
"tftp" => nil,
"dns" => nil
}
[ERROR 2014-03-03 18:34:34 Exception] Error: no implicit conversion of Symbol into Integer
Error: no implicit conversion of Symbol into Integer
[ERROR 2014-03-03 18:34:34 Exception]

TypeError (no implicit conversion of Symbol into Integer):
/home/inf/.gem/ruby/gems/hammer_cli_foreman-0.0.18/lib/hammer_cli_foreman/output/formatters.rb:30:in `[]'
/home/inf/.gem/ruby/gems/hammer_cli_foreman-0.0.18/lib/hammer_cli_foreman/output/formatters.rb:30:in `format'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/formatters.rb:62:in `block in format'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/formatters.rb:62:in `each'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/formatters.rb:62:in `inject'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/formatters.rb:62:in `format'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/adapter/csv.rb:33:in `block (3 levels) in print_collection'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/adapter/csv.rb:29:in `each'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/adapter/csv.rb:29:in `inject'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/adapter/csv.rb:29:in `block (2 levels) in print_collection'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/adapter/csv.rb:28:in `each'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/adapter/csv.rb:28:in `block in print_collection'
/usr/share/ruby/csv.rb:1155:in `generate'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/adapter/csv.rb:69:in `generate'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/adapter/csv.rb:24:in `print_collection'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/adapter/csv.rb:20:in `print_record'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/output/output.rb:20:in `print_record'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/abstract.rb:140:in `print_record'
/home/inf/.gem/ruby/gems/hammer_cli_foreman-0.0.18/lib/hammer_cli_foreman/commands.rb:158:in `print_data'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/apipie/read_command.rb:10:in `execute'
/home/inf/.gem/ruby/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/abstract.rb:22:in `run'
/home/inf/.gem/ruby/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute'
/home/inf/.gem/ruby/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/abstract.rb:22:in `run'
/home/inf/.gem/ruby/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute'
/home/inf/.gem/ruby/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/lib/hammer_cli/abstract.rb:22:in `run'
/home/inf/.gem/ruby/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run'
/home/inf/.gem/ruby/gems/hammer_cli-0.0.18/bin/hammer:77:in `<top (required)>'
/usr/bin/hammer:23:in `load'
/usr/bin/hammer:23:in `<main>'

Actions #1

Updated by Martin Bacovsky about 10 years ago

  • Category set to Hammer core
  • Status changed from New to Assigned
  • Assignee set to Martin Bacovsky
  • Target version set to 1.9.0

The problem is in the CSV adapter as it converts nils to empty strings. That can confuse formatters in some cases.

Actions #2

Updated by Martin Bacovsky about 10 years ago

  • Status changed from Assigned to Ready For Testing
Actions #3

Updated by Martin Bacovsky about 10 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Applied in changeset foreman:hammer-cli|commit:ecbc095e3f90ec68cdab289d521f6a69a560cf74.

Actions

Also available in: Atom PDF