Bug #9882
Updated by Dominic Cleal almost 10 years ago
When creating Description of problem: Customer is attempting to create a new host on a compute resource 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 no compute attributes or compute profile, you get the error "mac value is blank": # hammer -u … -p … compute-resource info --id 22 | grep -i provider 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", Provider: Libvirt "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: { # hammer -u … -p … host create \ :search => "name = \"2-Medium\"" } [DEBUG 2014-12-23 11:49:53 API] Headers: { :params => { --architecture-id 37 \ :search => "name = \"2-Medium\"" } } [DEBUG 2014-12-23 11:49:54 API] Response { --domain-id 42 \ "sort" => { "by" => nil, --environment-id 81 \ "order" => nil }, "total" => 3, --location-id 258 \ "page" => 1, "search" => "name = \"2-Medium\"", "results" => [ --mac 'a9:1a:9a:70:be:60' \ [0] { "updated_at" => "2014-12-15T19:20:25Z", "created_at" => "2014-12-15T19:20:25Z", "name" => "2-Medium", "id" => 2 --medium-id 32 \ } ], "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", --name 'AkqttNPO2' \ "host_parameters_attributes" => {}, "enabled" => true, "subnet_id" => "1", "name" => "example_vm", "compute_attributes" => { "interfaces_attributes" => {}, "start" => "true", "volumes_attributes" => {}, "nics_attributes" => {} --operatingsystem-id 43 \ }, "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!" ] --organization-id 259 \ }, --partition-table-id 28 \ "full_messages" => [ [0] "mac value is blank!" --puppet-proxy-id 1 \ --root-pass 'changeme' \ --compute-resource-id 22 ], "id" => nil } } [ERROR 2014-12-23 11:50:02 Exception] mac value is blank! Could not create the host: mac value is blank! Foreman detects whether the host 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: Failure with "you must specify either compute attributes or not based on the presence of the compute_resource_id *and* some attributes to create it with. a compute profile"