Bug #9144
closedhammer host create with mac results in "mac value is blank"
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1177570
Description of problem:
Customer is attempting to create a new host using the hammer command:
hammer -d host create --architecture-id 1 --domain-id 1 --environment-id 3 --hostgroup-id 3 --medium-id 7 --mac 52:54:00:12:34:45 --name example-vm --operatingsystem-id 1 --owner-id 3 --partition-table-id 7 --provision-method build --puppet-ca-proxy-id 1 --puppet-proxy-id 1 --ask-root-password true --subnet-id 1 --compute-resource-id 1 --compute-profile "2-Medium" --compute-attributes start=true --model-id 1
This fails with the error "mac value is blank" despite the MAC of the intended host being supplied. The following debug log is generated from the command:
[ INFO 2014-12-23 11:49:52 Init] Initialization of Hammer CLI (0.1.1) has started... [DEBUG 2014-12-23 11:49:52 Init] Running at ruby 1.8.7-p374 [ INFO 2014-12-23 11:49:52 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded [ INFO 2014-12-23 11:49:52 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded [ INFO 2014-12-23 11:49:52 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded [ INFO 2014-12-23 11:49:52 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded [DEBUG 2014-12-23 11:49:52 Connection] Registered: foreman [DEBUG 2014-12-23 11:49:52 API] Global headers: { :accept => "application/json;version=2", :content_type => "application/json", "Accept-Language" => "en" } [ INFO 2014-12-23 11:49:53 Modules] Extension module hammer_cli_foreman (0.1.1) loaded [ INFO 2014-12-23 11:49:53 Modules] Extension module hammer_cli_import (0.10.4) loaded [ INFO 2014-12-23 11:49:53 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed. [ INFO 2014-12-23 11:49:53 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created. [ INFO 2014-12-23 11:49:53 Modules] Extension module hammer_cli_katello (0.0.4) loaded [DEBUG 2014-12-23 11:49:53 Init] Using locale 'en' [DEBUG 2014-12-23 11:49:53 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/locale' [DEBUG 2014-12-23 11:49:53 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.1/locale' [DEBUG 2014-12-23 11:49:53 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_katello-0.0.4/locale' [ INFO 2014-12-23 11:49:53 HammerCLI::MainCommand] Called with options: {"option_debug"=>true} [ INFO 2014-12-23 11:49:53 HammerCLIForeman::Host] Called with options: {} [ INFO 2014-12-23 11:49:53 HammerCLIForeman::Host::CreateCommand] Called with options: {"option_puppet_ca_proxy_id"=>"1", "option_managed"=>true, "option_operatingsystem_id"=>"1", "option_domain_id"=>"1", "option_hostgroup_id"=>"3", "option_model_id"=>"1", "option_puppet_proxy_id"=>"1", "option_subnet_id"=>"1", "option_owner_id"=>"3", "option_name"=>"example_vm", "option_build"=>true, "option_environment_id"=>"3", "option_mac"=>"52:54:00:12:34:45", "option_compute_profile_name"=>"2-Medium", "option_compute_resource_id"=>"1", "option_partition_table_id"=>"7", "option_ask_root_password"=>"***", "option_architecture_id"=>"1", "option_medium_id"=>"7", "option_interface_list"=>[], "option_compute_attributes"=>{"start"=>"true"}, "option_enabled"=>true, "option_provision_method"=>"build", "option_volume_list"=>[]} [ INFO 2014-12-23 11:49:53 API] GET /api/compute_profiles [DEBUG 2014-12-23 11:49:53 API] Params: { :search => "name = \"2-Medium\"" } [DEBUG 2014-12-23 11:49:53 API] Headers: { :params => { :search => "name = \"2-Medium\"" } } [DEBUG 2014-12-23 11:49:54 API] Response { "sort" => { "by" => nil, "order" => nil }, "total" => 3, "page" => 1, "search" => "name = \"2-Medium\"", "results" => [ [0] { "updated_at" => "2014-12-15T19:20:25Z", "created_at" => "2014-12-15T19:20:25Z", "name" => "2-Medium", "id" => 2 } ], "per_page" => 50, "subtotal" => 1 } Enter the root password for the host: [ INFO 2014-12-23 11:50:00 API] POST /api/hosts [DEBUG 2014-12-23 11:50:00 API] Params: { "host" => { "ptable_id" => "7", "compute_profile_id" => 2, "root_pass" => "*REDACTED*", "owner_id" => "3", "medium_id" => "7", "managed" => true, "provision_method" => "build", "puppet_ca_proxy_id" => "1", "hostgroup_id" => "3", "model_id" => "1", "operatingsystem_id" => "1", "puppet_proxy_id" => "1", "build" => true, "mac" => "52:54:00:12:34:45", "environment_id" => "3", "domain_id" => "1", "architecture_id" => "1", "host_parameters_attributes" => {}, "enabled" => true, "subnet_id" => "1", "name" => "example_vm", "compute_attributes" => { "interfaces_attributes" => {}, "start" => "true", "volumes_attributes" => {}, "nics_attributes" => {} }, "compute_resource_id" => "1" } } [DEBUG 2014-12-23 11:50:00 API] Headers: {} [DEBUG 2014-12-23 11:50:02 API] 422 Unprocessable Entity { "error" => { "errors" => { "base" => [ [0] "mac value is blank!" ] }, "full_messages" => [ [0] "mac value is blank!" ], "id" => nil } } [ERROR 2014-12-23 11:50:02 Exception] mac value is blank! Could not create the host: mac value is blank!
Version-Release number of selected component (if applicable):
foreman-1.6.0.49-1.el6sat.noarch
foreman-compute-1.6.0.49-1.el6sat.noarch
foreman-gce-1.6.0.49-1.el6sat.noarch
foreman-libvirt-1.6.0.49-1.el6sat.noarch
foreman-ovirt-1.6.0.49-1.el6sat.noarch
foreman-postgresql-1.6.0.49-1.el6sat.noarch
foreman-proxy-1.6.0.30-1.el6sat.noarch
foreman-selinux-1.6.0.14-1.el6sat.noarch
foreman-vmware-1.6.0.49-1.el6sat.noarch
ruby193-rubygem-foreman_bootdisk-2.0.6-1.1.el6sat.noarch
ruby193-rubygem-foreman_discovery-1.3.0-2.el6sat.noarch
ruby193-rubygem-foreman_hooks-0.3.5-2.el6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.0.4-1.el6sat.noarch
ruby193-rubygem-foreman-tasks-0.6.9-1.1.el6sat.noarch
rubygem-hammer_cli-0.1.1-12.el6sat.noarch
rubygem-hammer_cli_foreman-0.1.1-16.el6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3-3.el6sat.noarch
rubygem-hammer_cli_import-0.10.4-1.3.el6sat.noarch
rubygem-hammer_cli_katello-0.0.4-14.el6sat.noarch
satellite-master.engi.oanda.com-foreman-client-1.0-1.noarch
satellite-master.engi.oanda.com-foreman-proxy-1.0-1.noarch
How reproducible:
Every time
Steps to Reproduce:
1. run command
Actual results:
Failure with "mac value is blank"
Expected results:
Succesful virtual machine creation.
Additional info:
Updated by Dominic Cleal about 9 years ago
- Description updated (diff)
- Category set to API
- Status changed from New to Need more information
- Assignee deleted (
Ohad Levy)
It's helpful if you can format the text so it's readable.
What type of compute resource is being used? I can see it's a PXE build being requested.
Please also provide server-side logs.
Updated by Shlomi Zadok about 9 years ago
Can't reproduce. Using: foreman 1.8-develop, hammer_cli-0.1.4, hammer_cli_foreman-0.1.4.
The response I got:
Hammer
Params: { "host" => { "name" => "example-vm", "location_id" => "1", "organization_id" => "1", "environment_id" => "3", "mac" => "52:54:00:12:34:45", "architecture_id" => "1", "domain_id" => "1", "puppet_proxy_id" => "1", "operatingsystem_id" => "1", "medium_id" => "7", "ptable_id" => "7", "subnet_id" => "1", "compute_resource_id" => "1", "model_id" => "1", "hostgroup_id" => "3", "puppet_ca_proxy_id" => "1", "build" => true, "enabled" => true, "provision_method" => "build", "managed" => true, "compute_profile_id" => 2, "compute_attributes" => { "start" => "true", "volumes_attributes" => {}, "interfaces_attributes" => {}, "nics_attributes" => {} }, "owner_id" => "3", "puppetclass_ids" => nil, "host_parameters_attributes" => {}, "root_pass" => "12121212"
Foreman log:
Started POST "/api/hosts" for 127.0.0.1 at 2015-02-11 22:58:02 +0200 Processing by Api::V2::HostsController#create as JSON Parameters: {"host"=>{"name"=>"example-vm", "location_id"=>"1", "organization_id"=>"1", "environment_id"=>"3", "mac"=>"52:54:00:12:34:45", "architecture_id"=>"1", "domain_id"=>"1", "puppet_proxy_id"=>"1", "operatingsystem_id"=>"1", "medium_id"=>"7", "ptable_id"=>"7", "subnet_id"=>"1", "compute_resource_id"=>"1", "model_id"=>"1", "hostgroup_id"=>"3", "puppet_ca_proxy_id"=>"1", "build"=>true, "enabled"=>true, "provision_method"=>"build", "managed"=>true, "compute_profile_id"=>2, "compute_attributes"=>{"start"=>"true", "volumes_attributes"=>{}, "interfaces_attributes"=>{}, "nics_attributes"=>{}}, "owner_id"=>"3", "puppetclass_ids"=>nil, "host_parameters_attributes"=>{}, "root_pass"=>"[FILTERED]"}, "apiv"=>"v2"}
(* it failed cause my smart-proxy was down. but that's irrelevant)
Updated by Tom Caspy about 9 years ago
yup, odd indeed, I just verified it on my machine as well, it worked as expected.
Also, there's an automated test for this (in foreman, don't know about hammer, but it should work)
Updated by The Foreman Bot about 9 years ago
- Status changed from Need more information to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2262 added
- Pull request deleted (
)
Updated by Tom Caspy about 9 years ago
- Status changed from Ready For Testing to Closed
- Pull request added
- Pull request deleted (
https://github.com/theforeman/foreman/pull/2262)
Updated by The Foreman Bot about 9 years ago
- Pull request https://github.com/theforeman/foreman/pull/2262 added
- Pull request deleted (
)
Updated by Dominic Cleal about 9 years ago
- Status changed from Closed to Resolved
Updated by Marek Hulán over 8 years ago
- Pull request added
- Pull request deleted (
https://github.com/theforeman/foreman/pull/2262)