Project

General

Profile

Actions

Bug #3987

closed

Host creation with hammer fails with 500 error

Added by Matt Chesler over 10 years ago. Updated over 10 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When attempting to create a host using the hammer CLI, we get a 500 response.

$ hammer host create --name host-1.domain.com --puppet-class-ids 163 --environment-id 4 --architecture-id 1 --domain-id 3 --puppet-proxy-id 1 --operatingsystem-id 3 --partition-table-id 10 --hostgroup-id 1 --puppet-ca-proxy-id 1 --compute-resource-id 1 --interface="type=network,network=Prod" --volume="capacity=50G"
Could not create the host:
Error: 500 Internal Server Error

Looking at the foreman logs, I see the following:

Started POST "/api/hosts" for 127.0.0.1 at 2014-01-09 16:40:43 -0500
Processing by Api::V1::HostsController#create as JSON
Parameters: {"host"=>{"enabled"=>true, "domain_id"=>"3", "name"=>"host-1.domain.com", "ptable_id"=>"10", "build"=>true, "puppet_class_ids"=>["163"], "compute_attributes"=>{"volumes_attributes"=>{"0"=>{"capacity"=>"50G"}}, "interfaces_attributes"=>{"0"=>{"network"=>"Prod", "type"=>"network"}}, "nics_attributes"=>{"0"=>{"network"=>"Prod", "type"=>"network"}}}, "managed"=>true, "compute_resource_id"=>"1", "puppet_proxy_id"=>"1", "architecture_id"=>"1", "environment_id"=>"4", "host_parameters_attributes"=>{}, "puppet_ca_proxy_id"=>"1", "hostgroup_id"=>"1", "operatingsystem_id"=>"3"}}
Authorized user admin(Admin User)
unknown attribute: puppet_class_ids (ActiveRecord::UnknownAttributeError)
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_assignment.rb:88:in `block in assign_attributes'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_assignment.rb:78:in `each'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_assignment.rb:78:in `assign_attributes'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/base.rb:498:in `initialize'
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_dispatch/routing/url_for.rb:103:in `initialize'
/usr/share/foreman/app/models/concerns/foreman/sti.rb:22:in `new'
/usr/share/foreman/app/models/concerns/foreman/sti.rb:22:in `new_with_cast'
/usr/share/foreman/app/models/host.rb:16:in `method_missing'
/usr/share/foreman/app/controllers/api/v1/hosts_controller.rb:45:in `create'
...

I found issue #3884, which looks somewhat related and attempted the following without success:

$ hammer host create --name host-1.domain.com --puppetclass-ids 163 --environment-id 4 --architecture-id 1 --domain-id 3 --puppet-proxy-id 1 --operatingsystem-id 3 --partition-table-id 10 --hostgroup-id 1 --puppet-ca-proxy-id 1 --compute-resource-id 1 --interface="type=network,network=Prod" --volume="capacity=50G"
ERROR: Unrecognised option '--puppetclass-ids'

We're running Foreman 1.3.0 and the following gems:

foreman_api (0.1.8)
hammer_cli (0.0.9)
hammer_cli_foreman (0.0.10)


Related issues 1 (0 open1 closed)

Is duplicate of Hammer CLI - Bug #3818: Wrong name used for Puppet class selection in host createClosedMartin Bacovsky12/05/2013Actions
Actions #1

Updated by Dominic Cleal over 10 years ago

  • Is duplicate of Bug #3818: Wrong name used for Puppet class selection in host create added
Actions #2

Updated by Dominic Cleal over 10 years ago

  • Status changed from New to Duplicate

Thanks for the report Matt. I think this has been fixed via #3818 in hammer_cli_foreman 0.0.13 and above.

Actions

Also available in: Atom PDF