Project

General

Profile

Actions

Bug #10105

closed

host create fails with "Missing arguments for 'interfaces_attributes'"

Added by Tobias Kremer about 9 years ago. Updated almost 6 years ago.

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

Description

After several hours of debugging and trying to understand the many components involved in the hammer cli (apipiebindings anyone?) I'm raising this issue because I'm getting the feeling that this might be a bug.

We're running foreman 1.8.0 RC2 and I'm trying to create a new (vmware virtual machine) host with the hammer CLI:

# hammer -v -d host create \
    --hostgroup-id=2 \
    --compute-resource-id=1 \
    --compute-profile-id=1 \
    --environment-id=3 \
    --compute-attributes="cluster=<CLUSTER-NAME>" \
    --volume="datastore=<DATASTORE-NAME>,size_gb=7" \
    --interface="network=<NETWORK-NAME>" \
    --name="hammer01" 

which runs and fails like this:

[ INFO 2015-04-09T15:34:54 Init] Initialization of Hammer CLI (0.1.4) has started...
[DEBUG 2015-04-09T15:34:54 Init] Running at ruby 2.2.1-p85
[ INFO 2015-04-09T15:34:54 Init] Configuration from the file /Users/tkremer/.hammer/cli_config.yml has been loaded
[ INFO 2015-04-09T15:34:54 Init] Configuration from the file /Users/tkremer/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2015-04-09T15:34:55 Connection] Registered: foreman
[DEBUG 2015-04-09T15:34:55 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en" 
}
[ INFO 2015-04-09T15:34:55 Modules] Extension module hammer_cli_foreman (0.1.4) loaded
[DEBUG 2015-04-09T15:34:55 Init] Using locale 'en'
[DEBUG 2015-04-09T15:34:55 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/hammer_cli-0.1.4/locale'
[DEBUG 2015-04-09T15:34:55 Init] 'mo' files for locale domain 'hammer-cli@system' loaded from '/usr/share/locale'
[DEBUG 2015-04-09T15:34:55 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/hammer_cli_foreman-0.1.4/locale'
[DEBUG 2015-04-09T15:34:55 Init] 'mo' files for locale domain 'hammer-cli-foreman@system' loaded from '/usr/share/locale'
[ INFO 2015-04-09T15:34:55 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true}
[ INFO 2015-04-09T15:34:55 HammerCLIForeman::Host] Called with options: {}
[ INFO 2015-04-09T15:34:55 HammerCLIForeman::Host::CreateCommand] Called with options: {"option_managed"=>true, "option_build"=>true, "option_enabled"=>true, "option_compute_attributes"=>{"cluster"=>"<CLUSTER-NAME>"}, "option_volume_list"=>[{"datastore"=>"<DATASTORE-NAME>", "size_gb"=>"7"}], "option_interface_list"=>[{"network"=>"<NETWORK-NAME>"}], "option_environment_id"=>"3", "option_compute_resource_id"=>"1", "option_hostgroup_id"=>"2", "option_compute_profile_id"=>"1", "option_name"=>"hammer01"}
[ERROR 2015-04-09T15:34:55 Exception] Missing arguments for 'interfaces_attributes'
Could not create the host:
  Missing arguments for 'interfaces_attributes'
[ERROR 2015-04-09T15:34:55 Exception]

ApipieBindings::MissingArgumentsError (Missing arguments for 'interfaces_attributes'):
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/apipie-bindings-0.0.12/lib/apipie_bindings/action.rb:62:in `validate!'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/apipie-bindings-0.0.12/lib/apipie_bindings/api.rb:158:in `call'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/apipie-bindings-0.0.12/lib/apipie_bindings/resource.rb:14:in `call'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/hammer_cli-0.1.4/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/hammer_cli_foreman-0.1.4/lib/hammer_cli_foreman/commands.rb:179:in `send_request'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/hammer_cli-0.1.4/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/clamp-0.6.4/lib/clamp/command.rb:67:in `run'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/hammer_cli-0.1.4/lib/hammer_cli/abstract.rb:23:in `run'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/clamp-0.6.4/lib/clamp/subcommand/execution.rb:11:in `execute'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/clamp-0.6.4/lib/clamp/command.rb:67:in `run'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/hammer_cli-0.1.4/lib/hammer_cli/abstract.rb:23:in `run'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/clamp-0.6.4/lib/clamp/subcommand/execution.rb:11:in `execute'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/clamp-0.6.4/lib/clamp/command.rb:67:in `run'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/hammer_cli-0.1.4/lib/hammer_cli/abstract.rb:23:in `run'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/clamp-0.6.4/lib/clamp/command.rb:132:in `run'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/gems/hammer_cli-0.1.4/bin/hammer:108:in `<top (required)>'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/bin/hammer:23:in `load'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/bin/hammer:23:in `<main>'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/bin/ruby_executable_hooks:15:in `eval'
    /Users/tkremer/.rvm/gems/ruby-2.2.1@hammer/bin/ruby_executable_hooks:15:in `<main>'

So I tried specifying --interfaces-attributes (although it's not required or documented anywhere AFAICT) and set it to some arbitrary networking parameters:

# hammer -v -d host create \
    --hostgroup-id=2 \
    --compute-resource-id=1 \
    --compute-profile-id=1 \
    --environment-id=3 \
    --compute-attributes="cluster=<CLUSTER-NAME>" \
    --volume="datastore=<DATASTORE-NAME>,size_gb=7" \
    --interface="network=<NETWORK-NAME>" \
    --interfaces-attributes="mac=FF:FF:FF:FF:FF:FF" \
    --name="hammer01" 

which leads to the following error:

500 Internal Server Error
{
    "error" => {
        "message" => "can't convert Symbol into Integer" 
    }
}
[ERROR 2015-04-09T15:43:48 Exception] can't convert Symbol into Integer
Could not create the host:
  can't convert Symbol into Integer

Now, what am I doing wrong? What's the correct set of command line options necessary to make this work? ;-)

Thanks!


Related issues 2 (0 open2 closed)

Related to Hammer CLI - Feature #3849: Add commands for managing interfacesClosedTomáš Strachota12/11/2013Actions
Blocks Foreman - Tracker #10226: Core Sprint 1Resolved04/20/201505/10/2015

Actions
Actions

Also available in: Atom PDF