Bug 1177570 - hammer host create with mac results in "mac value is blank"
Summary: hammer host create with mac results in "mac value is blank"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API
Version: Unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
high vote
Target Milestone: Unspecified
Assignee: Tom Caspy
QA Contact: Tazim Kolhar
David O'Brien
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On: 1215659 1296877
Blocks: sat61-release-notes
TreeView+ depends on / blocked
 
Reported: 2014-12-29 05:44 UTC by Paul Wayper
Modified: 2019-06-13 21:25 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Creating a host with incomplete information for a compute resource was giving incorrect error messages. The proper error message is now being returned.
Clone Of:
Environment:
Last Closed: 2016-01-21 07:41:25 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:0052 normal SHIPPED_LIVE Satellite 6.1.6 bug fix update 2016-01-21 12:40:53 UTC

Description Paul Wayper 2014-12-29 05:44:36 UTC
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:

See bug http://projects.theforeman.org/issues/7265

Comment 1 RHEL Product and Program Management 2014-12-29 05:53:59 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Bryan Kearney 2015-01-28 13:21:35 UTC
Created redmine issue http://projects.theforeman.org/issues/9144 from this bug

Comment 4 Joe Giordano 2015-01-30 19:35:33 UTC
Seeing this also when using RHEV as the compute resource. 

hammer host create --name rhel7-rhev-2 --hostgroup "RHEL7 SOE GROUP"  --environment KT_Default_Organization_Development_1_RHEL7_SOE_3 --domain jgrhlab.com --compute-resource rhev-d1 --compute-profile 3-Large --subnet 100-KVM-NET1 --ip 192.168.100.173 --provision-method image --operatingsystem-id 5 --image-id 4

Comment 5 Tom Caspy 2015-02-18 13:27:29 UTC
Tried reproducing it and failed (see redmine for more info). Can you please recheck with sat 6.1?

Comment 7 jaudet 2015-03-18 17:14:42 UTC
On a Satellite-6.1.0-RHEL-7-20150317.0 system, I am able to create a managed host:

    # hammer -u … -p … host create \
        --architecture-id 30 \
        --domain-id 23 \
        --environment-id 53 \
        --location-id 208 \
        --mac 70:6b:4c:b2:20:ef \
        --medium-id 25 \
        --name xnzrcDHxjyx \
        --operatingsystem-id 25 \
        --organization-id 209 \
        --partition-table-id 21 \
        --puppet-proxy-id 1 \
        --root-pass password
    Host created
    # hammer -u … -p … host info --id 10 | grep name
    Cert name:          xnzrcdhxjyx.lbbv2vlue7

After adjusting the name and specifying a libvirt provider, I am unable to create a host:

    # hammer -u … -p … compute-resource info --id 25 | grep -i provider
    Provider:    Libvirt
    # hammer -u … -p … host create \
        --architecture-id 30 \
        --domain-id 23 \
        --environment-id 53 \
        --location-id 208 \
        --mac 70:6b:4c:b2:20:ef \
        --medium-id 25 \
        --name xnzrcDHxjyx2 \
        --operatingsystem-id 25 \
        --organization-id 209 \
        --partition-table-id 21 \
        --puppet-proxy-id 1 \
        --root-pass password \
        --compute-resource-id 25
    Could not create the host:
    mac value is blank!

On a Satellite-6.1.0-RHEL-6-20150317.0 system, I am able to create a managed host:

    # hammer -u … -p … host create \
        --architecture-id 37 \
        --domain-id 42 \
        --environment-id 81 \
        --location-id 258 \
        --mac 'a9:1a:9a:70:be:60' \
        --medium-id 32 \
        --name 'AkqttNPO' \
        --operatingsystem-id 43 \
        --organization-id 259 \
        --partition-table-id 28 \
        --puppet-proxy-id 1 \
        --root-pass 'changeme'
    Host created
    # hammer -u … -p … host info --id 8 | grep name
    Cert name:          akqttnpo.hbhfo36sgo

After adjusting the name and specifying a libvirt provider, I am unable to create a host:

    # hammer -u … -p … compute-resource info --id 22 | grep -i provider
    Provider:    Libvirt
    # hammer -u … -p … host create \
        --architecture-id 37 \
        --domain-id 42 \
        --environment-id 81 \
        --location-id 258 \
        --mac 'a9:1a:9a:70:be:60' \
        --medium-id 32 \
        --name 'AkqttNPO2' \
        --operatingsystem-id 43 \
        --organization-id 259 \
        --partition-table-id 28 \
        --puppet-proxy-id 1 \
        --root-pass 'changeme' \
        --compute-resource-id 22
    Could not create the host:
    mac value is blank!

Comment 8 jaudet 2015-03-19 17:02:42 UTC
An automated test for this bug will be added to QE's test suite shortly. See: https://github.com/SatelliteQE/robottelo/pull/2003

Comment 9 Tom Caspy 2015-03-23 10:40:41 UTC
there's no need to specify mac as it gets updated after the VM is created, but specifying something in either compute_attributes or a compute_profile_id is mandatory.

if you do --compute-attributes start=true it should work as expected. that's probably why I failed to replicate this before. I've tested again, and when neglecting to set these fields, I get the same result as you did, but when adding either field, everything is working again. Please verify this.

The error message is indeed wrong, it should be "you must specify either compute attributes or a compute profile", will changing the error message be the right approach for fixing this issue?

Comment 10 jaudet 2015-03-23 14:54:00 UTC
Yes, I think that fixing the error message is an appropriate solution.

Comment 11 jaudet 2015-03-23 15:32:03 UTC
Tested against Satellite-6.1.0-RHEL-7-20150320.1:

    $ nosetests tests/foreman/cli/test_host.py -m 1177570
    F
    ======================================================================
    FAIL: @Test: Create a libvirt host and specify just a MAC address.
    ----------------------------------------------------------------------
    Traceback (most recent call last):
    File "/home/ichimonji10/code/robottelo/robottelo/common/decorators.py", line 362, in wrapper_func
        return func(*args, **kwargs)
    File "/home/ichimonji10/code/robottelo/tests/foreman/cli/test_host.py", line 91, in test_bz_1177570
        self.assertNotIn('mac value is blank', result.stderr)
    AssertionError: 'mac value is blank' unexpectedly found in '[ERROR 2015-03-23 11:28:34 Exception] mac value is blank!\nCould not create the host:\n  mac value is blank!\n'
    ----------------------------------------------------------------------
    Ran 1 test in 15.778s

    FAILED (failures=1)

Comment 13 Bryan Kearney 2015-08-25 18:32:56 UTC
Upstream bug component is API

Comment 14 Marek Hulan 2015-09-04 07:59:07 UTC
The issue is in how the hammer is called. When we create the host through UI there's usually one compute interface by default. In all examples provided there's no compute interface specified, hence fog does not create any and when Foreman tries to load mac from VM it fails with the "mac value is blank!" error. To create the interface an extra argument must be specified, try adding following to the hammer command

  --interface type=network

In next satellite version this won't be necessary since we added matching of host interfaces with compute resource interfaces. Moving this to ON_QA so you can test and update the robotello test suite (I tried to help, see  https://github.com/SatelliteQE/robottelo/pull/2731)

Comment 15 jaudet 2015-09-09 18:43:02 UTC
Still waiting on https://github.com/SatelliteQE/robottelo/pull/2731

Comment 19 Og Maciel 2015-10-05 19:15:03 UTC
Automation shows:

# LANG=en_US.UTF-8  hammer -d -v -u admin -p changeme --output=csv host create --medium-id="26" --root-pass="abracadabra" --organization-id="318" --interface="type=network" --location-id="319" --architecture-id="37" --operatingsystem-id="24" --name="otozxlcowtdkrlmekcuqlvlfioo" --environment-id="231" --compute-resource-id="89" --domain-id="1" --puppet-proxy-id="1" --partition-table-id="44"
[ INFO 2015-10-05 15:11:30 Init] Initialization of Hammer CLI (0.1.4.12) has started...
[DEBUG 2015-10-05 15:11:30 Init] Running at ruby 2.0.0-p598
[ INFO 2015-10-05 15:11:30 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2015-10-05 15:11:30 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2015-10-05 15:11:30 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2015-10-05 15:11:30 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded
[ INFO 2015-10-05 15:11:30 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2015-10-05 15:11:30 Init] Configuration from the file /etc/hammer/cli.modules.d/gutterball.yml has been loaded
[ INFO 2015-10-05 15:11:30 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2015-10-05 15:11:30 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2015-10-05 15:11:30 Connection] Registered: foreman
[DEBUG 2015-10-05 15:11:30 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[ INFO 2015-10-05 15:11:30 Modules] Extension module hammer_cli_foreman (0.1.4.14) loaded
[ INFO 2015-10-05 15:11:30 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.2.7) loaded
[ INFO 2015-10-05 15:11:30 Modules] Extension module hammer_cli_foreman_discovery (0.0.1.10) loaded
[ INFO 2015-10-05 15:11:30 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2015-10-05 15:11:30 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2015-10-05 15:11:30 Modules] Extension module hammer_cli_gutterball (0.0.1.3) loaded
[ INFO 2015-10-05 15:11:30 Modules] Extension module hammer_cli_import (0.10.20) loaded
[ INFO 2015-10-05 15:11:30 Modules] Extension module hammer_cli_katello (0.0.7.17) loaded
[DEBUG 2015-10-05 15:11:30 Init] Using locale 'en'
[DEBUG 2015-10-05 15:11:30 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/share/gems/gems/hammer_cli-0.1.4.12/locale'
[DEBUG 2015-10-05 15:11:30 Init] 'mo' files for locale domain 'hammer-cli@system' loaded from '/usr/share/locale'
[DEBUG 2015-10-05 15:11:30 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/share/gems/gems/hammer_cli_foreman-0.1.4.14/locale'
[DEBUG 2015-10-05 15:11:30 Init] 'mo' files for locale domain 'hammer-cli-foreman@system' loaded from '/usr/share/locale'
[DEBUG 2015-10-05 15:11:30 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.3.9/locale'
[DEBUG 2015-10-05 15:11:30 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/share/gems/gems/hammer_cli_katello-0.0.7.17/locale'
[ INFO 2015-10-05 15:11:30 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_username"=>"admin", "option_password"=>"***", "option_output"=>"csv"}
[ INFO 2015-10-05 15:11:31 HammerCLIForeman::Host] Called with options: {}
[ INFO 2015-10-05 15:11:31 HammerCLIForeman::Host::CreateCommand] Called with options: {"option_managed"=>true, "option_build"=>true, "option_enabled"=>true, "option_volume_list"=>[], "option_interface_list"=>[{"type"=>"network"}], "option_location_id"=>"319", "option_organization_id"=>"318", "option_environment_id"=>"231", "option_architecture_id"=>"37", "option_domain_id"=>"1", "option_operatingsystem_id"=>"24", "option_medium_id"=>"26", "option_ptable_id"=>"44", "option_compute_resource_id"=>"89", "option_name"=>"otozxlcowtdkrlmekcuqlvlfioo", "option_puppet_proxy_id"=>"1", "option_root_pass"=>"abracadabra"}
[ INFO 2015-10-05 15:11:31 API] POST /api/hosts
[DEBUG 2015-10-05 15:11:31 API] Params: {
    "host" => {
                              "name" => "otozxlcowtdkrlmekcuqlvlfioo",
                       "location_id" => "319",
                   "organization_id" => "318",
                    "environment_id" => "231",
                   "architecture_id" => "37",
                         "domain_id" => "1",
                   "puppet_proxy_id" => "1",
                "operatingsystem_id" => "24",
                         "medium_id" => "26",
                         "ptable_id" => "44",
               "compute_resource_id" => "89",
                         "root_pass" => "abracadabra",
                             "build" => true,
                           "enabled" => true,
                           "managed" => true,
                "compute_attributes" => {
               "volumes_attributes" => {},
            "interfaces_attributes" => {
                "0" => {
                    "type" => "network"
                }
            },
                  "nics_attributes" => {
                "0" => {
                    "type" => "network"
                }
            }
        },
                          "owner_id" => nil,
                "puppet_ca_proxy_id" => nil,
                   "puppetclass_ids" => nil,
        "host_parameters_attributes" => {}
    }
}
[DEBUG 2015-10-05 15:11:31 API] Headers: {}
[DEBUG 2015-10-05 15:11:31 API] 422 Unprocessable Entity
{
    "error" => {
                   "id" => nil,
               "errors" => {
            "base" => [
                [0] "Failed to create a compute foobarbaz (Libvirt) instance otozxlcowtdkrlmekcuqlvlfioo.<FQDN EDITED OUT>: undefined method `name' for nil:NilClass\n "
            ]
        },
        "full_messages" => [
            [0] "Failed to create a compute foobarbaz (Libvirt) instance otozxlcowtdkrlmekcuqlvlfioo.<FQDN EDITED OUT>: undefined method `name' for nil:NilClass\n "
        ]
    }
}
[ERROR 2015-10-05 15:11:31 Exception] Failed to create a compute foobarbaz (Libvirt) instance otozxlcowtdkrlmekcuqlvlfioo.<FQDN EDITED OUT>: undefined method `name' for nil:NilClass

Could not create the host:
  Failed to create a compute foobarbaz (Libvirt) instance otozxlcowtdkrlmekcuqlvlfioo.<FQDN EDITED OUT>: undefined method `name' for nil:NilClass

Comment 20 Og Maciel 2015-10-05 19:23:27 UTC
Furthermore, when I try the same command using my own system (the previous command uses a system provided by our automation), I get a different error:

hammer -u "${ADMIN_USER}" -p "${ADMIN_PASSWORD}" host create --medium-id=7 --root-pass='abracadabra' --organization-id=1 --interface="type=network" --location-id=1 --architecture-id=1 --operatingsystem-id=1 --name='omaciel-test' --environment-id=3  --compute-resource-id=2 --domain-id=1 --puppet-proxy-id="1" --partition-table-id=7
Could not create the host:
  IP address is invalid

If I provide a valid Host Group:

hammer -u "${ADMIN_USER}" -p "${ADMIN_PASSWORD}" host create --medium-id=7 --root-pass='abracadabra' --organization-id=1 --interface="type=network" --location-id=1 --architecture-id=1 --operatingsystem-id=1 --name='omaciel-test' --environment-id=3  --compute-resource-id=2 --domain-id=1 --puppet-proxy-id="1" --partition-table-id=7 --hostgroup="RHEL 7 Server 64-bit HG"
Could not create the host:
  Failed to create a compute local_libvirt (Libvirt) instance omaciel-test.idmqe.<DOMAIN EDITED OUT>: can't convert nil into String

Comment 21 Bryan Kearney 2015-10-05 20:04:06 UTC
Upstream bug assigned to tcaspy@redhat.com

Comment 26 Marek Hulan 2015-12-09 08:02:18 UTC
please retest with commands I provided, it works for me

Comment 28 Tazim Kolhar 2016-01-16 14:35:02 UTC
Tested on sat6.1.6 compose 5:

# rpm -qa | grep foreman
hp-dl180g6-01.rhts.eng.bos.redhat.com-foreman-proxy-1.0-1.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch
foreman-vmware-1.7.2.50-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.5-1.el7sat.noarch
foreman-selinux-1.7.2.17-1.el7sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.14-1.el7sat.noarch
foreman-ovirt-1.7.2.50-1.el7sat.noarch
foreman-1.7.2.50-1.el7sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.24-1.el7sat.noarch
ruby193-rubygem-foreman-tasks-0.6.15.7-1.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el7sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.10-1.el7sat.noarch
foreman-debug-1.7.2.50-1.el7sat.noarch
foreman-proxy-1.7.2.8-1.el7sat.noarch
hp-dl180g6-01.rhts.eng.bos.redhat.com-foreman-client-1.0-1.noarch
hp-dl180g6-01.rhts.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch
foreman-discovery-image-3.0.5-3.el7sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el7sat.noarch
foreman-libvirt-1.7.2.50-1.el7sat.noarch
foreman-gce-1.7.2.50-1.el7sat.noarch
rubygem-hammer_cli_foreman-0.1.4.15-1.el7sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.23-1.el7sat.noarch
foreman-postgresql-1.7.2.50-1.el7sat.noarch
foreman-compute-1.7.2.50-1.el7sat.noarch
ruby193-rubygem-foreman-redhat_access-0.2.4-1.el7sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el7sat.noarch

I am failing this BZ becoz, here are my observations:

1.) When we specify mac address in hammer-cli the host created
# hammer -u admin -p changeme host create --architecture-id 1 --domain-id 1 --environment-id 2 --hostgroup-id 1 --medium-id 7 --mac 52:54:00:df:d6:6g --name test8 --compute-resource-id 1 --organization-id 1 --location-id 1 --puppet-proxy-id 1 --partition-table-id 7 --root-pass **** --operatingsystem-id 2 --provision-method build --compute-attributes start=true --interface compute_type=network
Host created

2.) The production.log shows:
# tail -f production.log
2016-01-16 09:22:51 [I]   Parameters: {"host"=>{"name"=>"test8", "location_id"=>"1", "organization_id"=>"1", "environment_id"=>"2", "mac"=>"52:54:00:df:d6:6g", "architecture_id"=>"1", "domain_id"=>"1", "puppet_proxy_id"=>"1", "operatingsystem_id"=>"2", "medium_id"=>"7", "ptable_id"=>"7", "compute_resource_id"=>"1", "root_pass"=>"[FILTERED]", "hostgroup_id"=>"1", "build"=>true, "enabled"=>true, "provision_method"=>"build", "managed"=>true, "compute_attributes"=>{"start"=>"true", "volumes_attributes"=>{}, "interfaces_attributes"=>{"0"=>{"compute_type"=>"network"}}, "nics_attributes"=>{"0"=>{"compute_type"=>"network"}}}, "owner_id"=>nil, "puppet_ca_proxy_id"=>nil, "puppetclass_ids"=>nil, "host_parameters_attributes"=>{}}, "apiv"=>"v2"}
2016-01-16 09:22:51 [I] Authorized user admin(Admin User)
2016-01-16 09:22:53 [I] Adding Compute instance for test8.rhts.eng.bos.redhat.com
2016-01-16 09:22:53 [I] Create DHCP reservation for test8.rhts.eng.bos.redhat.com-52:54:00:6e:08:a0/192.168.100.23
2016-01-16 09:22:54 [I] Add DNS A record for test8.rhts.eng.bos.redhat.com/192.168.100.23
2016-01-16 09:22:54 [I] Add DNS PTR record for 192.168.100.23/test8.rhts.eng.bos.redhat.com
2016-01-16 09:22:54 [I] Add the TFTP configuration for test8.rhts.eng.bos.redhat.com
2016-01-16 09:22:54 [I] Fetching required TFTP boot files for test8.rhts.eng.bos.redhat.com
2016-01-16 09:22:54 [I]   Rendered api/v2/hosts/create.json.rabl (40.8ms)
2016-01-16 09:22:54 [I] Completed 200 OK in 3899ms (Views: 31.7ms | ActiveRecord: 71.2ms)

3.) Host info shows a different mac address:
# hammer -u admin -p changeme host info --id 8
Id:                 8
Name:               test8.rhts.eng.bos.redhat.com
Operating System:   RedHat 6.6
Host Group:         host_test_grp
IP:                 192.168.100.23
MAC:                52:54:00:6e:08:a0
UUID:               3b12d0af-211a-4276-ab9f-f54f648d59a1
Cert name:          test8.rhts.eng.bos.redhat.com
Environment:        KT_Default_Organization_Library_con_view_2
Managed:            true
Enabled:            true
Build:              true
Use image:          
Disk:               
Image file:         
SP Name:            
SP IP:              
SP MAC:             
SP Subnet:          
Installed at:       
Last report:        
Puppet CA Proxy Id: 1
Medium:             Default_Organization/Library/rhel6/rhel_repo
Model:              
Owner Id:           3
Subnet:             libvirt
Domain:             rhts.eng.bos.redhat.com
Puppet Proxy Id:    1
Owner Type:         User
Partition Table:    Kickstart default
Architecture:       x86_64
Image:              
Compute Resource:   libvirt
Comment:            
Parameters:         

Created at:         2016/01/16 14:22:54
Updated at:         2016/01/16 14:22:54


As, per my understanding: It should pick that "mac" address which is provided
in the hammer-cli . However, host info shows some different mac address.

Currently, I am failing this BZ since, even though the command works fine
the actual result is not as expected i.e "mac" address mentioned in the hammer
command is ultimately not assigned.

If,this behaviour is supposed to be waived for now, then please revert back
I will re-verify it and move it to Verified.
.

Thanks and Regards,
Tazim

Comment 29 Marek Hulan 2016-01-18 07:19:04 UTC
Since you use compute resource, the MAC is generated by hypervisor, therefore you see different value. In UI the MAC field is hidden if you select compute resource, in CLI I suppose we can't hide the argument. We could document this better, currently API says "required for managed host that is bare metal, not required if it’s a virtual machine", but that's a different bug I think. It is possible to create VM using hammer now so moving up. Tazim if you want to change the API docs, please create a separate BZ.

Comment 33 errata-xmlrpc 2016-01-21 07:41:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:0052


Note You need to log in before you can comment on or make changes to this bug.