Project

General

Profile

Bug #10105

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

Added by Tobias Kremer almost 4 years ago. Updated 8 months ago.

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

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

Related to Hammer CLI - Feature #3849: Add commands for managing interfacesClosed2013-12-11
Blocks Foreman - Tracker #10226: Core Sprint 1Resolved2015-04-202015-05-10

History

#1 Updated by Dominic Cleal almost 4 years ago

  • Related to Feature #3849: Add commands for managing interfaces added

#2 Updated by Dominic Cleal almost 4 years ago

  • Project changed from Foreman to Hammer CLI

I'll let Tomas or one of the CLI devs confirm, but I think this is what's being fixed under the banner of #3849.

https://github.com/theforeman/hammer-cli-foreman/pull/174 is the pull request if you want to try a patch to hammer-cli-foreman, but it makes Hammer support the new 1.8 networking changes including interface attributes.

#3 Updated by Martin Bacovsky almost 4 years ago

  • Category set to Hammer core
  • Status changed from New to Assigned
  • Assignee set to Martin Bacovsky
  • Pull request https://github.com/Apipie/apipie-bindings/pull/26 added
  • Pull request deleted ()

Tomas filed a bug describing this behaviour in apipie-bindings https://github.com/Apipie/apipie-bindings/issues/25. The PR fixing the problem is https://github.com/Apipie/apipie-bindings/pull/26.

AFAIK Tomas workarouned the bug in bindings with https://github.com/theforeman/foreman/pull/2270, so the update of apipie-bindings is not neccessary.

#4 Updated by Tobias Kremer almost 4 years ago

Thanks, guys! I locally applied the apipie-bindings pull request #26 and the host creation worked flawlessly (without hammer complaining about a missing --interfaces-attributes option).

#5 Updated by Tobias Kremer almost 4 years ago

Tobias Kremer wrote:

Thanks, guys! I locally applied the apipie-bindings pull request no. 26 and the host creation worked flawlessly (without hammer complaining about a missing --interfaces-attributes option).

#6 Updated by Dominic Cleal almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 28

#7 Updated by Eric Helms almost 4 years ago

#8 Updated by Martin Bacovsky almost 4 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

PR in apipie-bindings was merged

Also available in: Atom PDF