Hammer CLI, VMWare, and MAC Addresses

The team and I here are trying to use hammer to provision a set of new
systems. We've run into a roadblock that I'm stuck on and am hoping that
I'm just missing something, but I'm worried it is perhaps a deeper problem:

We have VMWare hosts, we are running foreman 1.10. We are able to create
Scientific 7 hosts with reckless abandon in the UI with no problems. With
hammer, though, not so much. I am able to get the host to create with
hammer, however, it fails TFTP and DHCP. Here's the host create:

$ hammer -d host create
–environment-id=1
–architecture-id=1
–compute-resource-id=1
–domain-id=2
–operatingsystem-id=1
–partition-table-id=60
–puppet-proxy-id=2
–hostgroup-title='rentpath'
–interface="primary=true,managed=false,provision=true,domain_id=2,subnet_id=1,compute_type=VirtualVmxnet3,compute_network='Management
Servers'"
-subnet-id=1
–compute-profile=micro
–compute-attributes="cluster='nonprod',start=0,cpus=2,memory_mb=2048,guest_id=rhel7_64Guest,scsi_controller_type=ParaVirtualSCSIController"

–volume="datastore=dev-hlun0,thin=false,eager_zero=1,size_gb=20"
–provision-method=build
–name='test-003'

This will succeed and the host will be created. However, it fails TFTP. I
believe this is because we set managed=false, so the expected behavior is
that of course DHCP and TFTP is not set up for that host. I think I can
"solve" this problem by creating a default menu on the TFTP server, but
that feels like cheating and I don't wanna do that unless that's really the
only way forward.

The problem I have is this. When I set managed=true, then of course that
would solve the TFTP etc. issue, however, Foreman comes back with "500
Invalid MAC " … I believe this is because of the way VMWare provisioning
works - and somehow, the MAC is not available when it should be. So we have
a catch 22, and I'm completely baffled as to how to resolve it.

When I look at the foreman production.log, the UI sends some additional
parameters for the interface – "new_interface => { … _destroy => true
… }" and I'm wondering if that is a work-around for the problem to get
at least one managed host, or if that's a red herring.

So, the question I have is this:

1 - am I missing some trick that google has been unable to help me find,
2 - is there a bug here?
3 - does anyone have any suggestions or workarounds or fixes to this
conundrum?

Thanks,
Baron.

Hello,
the command seems right but please make sure you use VMWare IDs where
necessary in --interface, --volume and --compute-attributes. See [1] for
more details.

Could you share the relevant part of server logs? It will hopefully give
us more details to identify whether you're facing a known problem or not.

Regards
Tomas

[1]

··· On 03/08/2016 04:50 PM, Baron Chandler wrote: > The team and I here are trying to use hammer to provision a set of new > systems. We've run into a roadblock that I'm stuck on and am hoping that > I'm just missing something, but I'm worried it is perhaps a deeper problem: > > We have VMWare hosts, we are running foreman 1.10. We are able to create > Scientific 7 hosts with reckless abandon in the UI with no problems. > With hammer, though, not so much. I am able to get the host to create > with hammer, however, it fails TFTP and DHCP. Here's the host create: > > $ hammer -d host create \ > --environment-id=1 \ > --architecture-id=1 \ > --compute-resource-id=1 \ > --domain-id=2 \ > --operatingsystem-id=1 \ > --partition-table-id=60 \ > --puppet-proxy-id=2 \ > --hostgroup-title='rentpath' \ > --interface="primary=true,managed=false,provision=true,domain_id=2,subnet_id=1,compute_type=VirtualVmxnet3,compute_network='Management > Servers'" \ > -subnet-id=1 \ > --compute-profile=micro \ > --compute-attributes="cluster='nonprod',start=0,cpus=2,memory_mb=2048,guest_id=rhel7_64Guest,scsi_controller_type=ParaVirtualSCSIController" > \ > --volume="datastore=dev-hlun0,thin=false,eager_zero=1,size_gb=20" \ > --provision-method=build \ > --name='test-003' > > > This will succeed and the host will be created. However, it fails TFTP. > I believe this is because we set managed=false, so the expected behavior > is that of course DHCP and TFTP is not set up for that host. I think I > can "solve" this problem by creating a default menu on the TFTP server, > but that feels like cheating and I don't wanna do that unless that's > really the only way forward. > > The problem I have is this. When I set managed=true, then of course that > would solve the TFTP etc. issue, however, Foreman comes back with "500 > Invalid MAC " ... I believe this is because of the way VMWare > provisioning works - and somehow, the MAC is not available when it > should be. So we have a catch 22, and I'm completely baffled as to how > to resolve it. > > When I look at the foreman production.log, the UI sends some additional > parameters for the interface -- "new_interface => { .... _destroy => > true ..... }" and I'm wondering if that is a work-around for the problem > to get at least one managed host, or if that's a red herring. > > > So, the question I have is this: > > 1 - am I missing some trick that google has been unable to help me find, > 2 - is there a bug here? > 3 - does anyone have any suggestions or workarounds or fixes to this > conundrum? > > Thanks, > Baron. > > -- > You received this message because you are subscribed to the Google > Groups "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to foreman-users+unsubscribe@googlegroups.com > . > To post to this group, send email to foreman-users@googlegroups.com > . > Visit this group at https://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout.

Baron / Thomas
Any updates on this issue? I am having the exact same "invalid mac" error
went provisioning vm's on vmware that I have been troubleshooting
intensively for the past 3 days. This issues started when I upgraded from
1.9 to 1.10.2. The only big difference that I see is that Baron is running
centos 7.x and I am running 6.7. I have been tracing through all debug
info in /var/log/foreman/production.log and check the proxy logs too which
contain nothing of interest. When I revert back to version 1.9 everything
works fine. I have played around extensively with the parameter - using
only the numeric ID's when possible and removing and extra parameters to
reduce the complexity of the hammer call but the only thing that works is
changing the interface from "managed=true" to "managed=false" which then
results in what Baron mentioned where we run into the expected pxe issues.
The UI works just fine in my case. I have also create new host groups
and templates etc… to eliminate any issues with those resource that may
have happened during the upgrade from 1.9 to 1.10.2. Thanks for any input

  • details below. -scott

Versions:

foreman-ec2-1.10.2-1.el6.noarch
foreman-vmware-1.10.2-1.el6.noarch
tfm-rubygem-foreman_docker-doc-1.4.1-2.fm1_10.el6.noarch
foreman-selinux-1.10.2-1.el6.noarch
foreman-compute-1.10.2-1.el6.noarch
foreman-cli-1.10.2-1.el6.noarch
tfm-rubygem-foreman_ansible-0.2.2-1.fm1_10.el6.noarch
tfm-rubygem-foreman_docker-1.4.1-2.fm1_10.el6.noarch
tfm-rubygem-hammer_cli_foreman-0.5.1-1.el6.noarch
foreman-1.10.2-1.el6.noarch
tfm-rubygem-foreman_setup-3.0.2-1.fm1_10.el6.noarch
foreman-proxy-1.10.2-1.el6.noarch
foreman-release-1.10.2-1.el6.noarch
foreman-debug-1.10.2-1.el6.noarch
foreman-postgresql-1.10.2-1.el6.noarch
foreman-installer-1.10.2-1.el6.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.9-1.fm1_10.el6.noarch
foreman-release-scl-1-1.el6.x86_64

What I am passing via Hammer:

hammer -d -v --show-ids host create --compute-resource="pr01vcden2"
–hostgroup-id=6 --compute-profile="doc_tier" --name=xx00tst046
–build="yes"
–compute-attributes="cpus=2,memory_mb=16384,cluster=NPROD,guest_id=centos64Guest,start=1"
–environment-id=1 --architecture-id=1 --domain-id=1 --puppet-proxy-id=1
–operatingsystem-id=8 --partition-table-id=59
–interface="compute_network=vrid242,type=Nic::Managed,domain_id=1,managed=true,primary=true,provision=true,virtual=false,subnet_id=4"
–volume="datastore=ds_vol_nprod_esx_01_sata_iscsi_06,name=Hard
Disk,size_gb=40"

What foreman thinks I am passing:

Called with options: {"option_managed"=>true, "option_build"=>true,
"option_enabled"=>true, "option_overwrite"=>true,
"option_compute_attributes"=>{"cpus"=>"2", "memory_mb"=>"16384",
"cluster"=>"NPROD", "guest_id"=>"centos64Guest", "start"=>"1"},
"option_volume_list"=>[{"datastore"=>"ds_vol_nprod_esx_01_sata_iscsi_06",
"name"=>"Hard Disk", "size_gb"=>"40"}],
"option_interface_list"=>[{"compute_network"=>"vrid242",
"type"=>"Nic::Managed", "domain_id"=>"1", "managed"=>"true",
"primary"=>"true", "provision"=>"true", "virtual"=>"false",
"subnet_id"=>"4"}], "option_environment_id"=>1,
"option_architecture_id"=>1, "option_domain_id"=>1,
"option_operatingsystem_id"=>8, "option_ptable_id"=>59,
"option_compute_resource_name"=>"pr01vcden2", "option_hostgroup_id"=>6,
"option_compute_profile_name"=>"doc_tier", "option_name"=>"xx00tst046",
"option_puppet_proxy_id"=>1}

Debug Error

[ERROR 2016-03-25 08:35:42 Exception] Invalid MAC
Could not create the host:
Invalid MAC
[ERROR 2016-03-25 08:35:42 Exception]

RestClient::InternalServerError (500 Internal Server Error):

/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in
`return!'

/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in
`process_result'

/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in
block in transmit' /opt/rh/ruby193/root/usr/share/ruby/net/http.rb:746:instart'

/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in
`transmit'

/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in
`execute'

/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in
`execute'

/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:67:in
`post'

/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.14/lib/apipie_bindings/api.rb:286:in
`call_client'

/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.14/lib/apipie_bindings/api.rb:217:in
`http_call'

/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.14/lib/apipie_bindings/api.rb:163:in
`call'

/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.0.14/lib/apipie_bindings/resource.rb:14:in
`call'

/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/apipie/command.rb:43:in
`send_request'

/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1/lib/hammer_cli_foreman/commands.rb:189:in
`send_request'

/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/apipie/command.rb:34:in
`execute'

/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in
`run'

/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/abstract.rb:22:in
`run'

/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in
`execute'

/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in
`run'

/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/abstract.rb:22:in
`run'

/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in
`execute'

/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in
`run'

/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/lib/hammer_cli/abstract.rb:22:in
`run'

/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in
`run'

/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1/bin/hammer:125:in
<top (required)>' /usr/bin/hammer:23:inload'
/usr/bin/hammer:23:in `<main>'

production.log

2016-03-25 08:35:39 [app] [I] Parameters: {"search"=>"name =
&quot;doc_tier&quot;", "apiv"=>"v2", "compute_profile"=>{}}
2016-03-25 08:35:39 [app] [I] Authorized user admin(Admin User)
2016-03-25 08:35:39 [app] [I] Rendered
api/v2/compute_profiles/index.json.rabl within api/v2/layouts/index_layout
(3.2ms)
2016-03-25 08:35:39 [app] [I] Completed 200 OK in 28ms (Views: 6.2ms |
ActiveRecord: 5.0ms)
2016-03-25 08:35:39 [app] [I]
>
> Started POST "/api/hosts" for 10.202.16.220 at 2016-03-25 08:35:39 -0600
2016-03-25 08:35:39 [app] [I] Processing by Api::V2::HostsController#create
as JSON
2016-03-25 08:35:39 [app] [I] Parameters: {"host"=>{"name"=>"xx00tst046",
"environment_id"=>1, "architecture_id"=>1, "domain_id"=>1,
"puppet_proxy_id"=>1, "operatingsystem_id"=>8, "ptable_id"=>59,
"compute_resource_id"=>1, "hostgroup_id"=>6, "build"=>true,
"enabled"=>true, "managed"=>true, "compute_profile_id"=>9,
"compute_attributes"=>{"cpus"=>"2", "memory_mb"=>"16384",
"cluster"=>"NPROD", "guest_id"=>"centos64Guest", "start"=>"1",
"volumes_attributes"=>{"0"=>{"datastore"=>"ds_vol_nprod_esx_01_sata_iscsi_06",
"name"=>"Hard Disk", "size_gb"=>"40"}}}, "overwrite"=>true,
"host_parameters_attributes"=>{},
"interfaces_attributes"=>{"0"=>{"type"=>"Nic::Managed", "domain_id"=>"1",
"managed"=>"true", "primary"=>"true", "provision"=>"true",
"virtual"=>"false", "subnet_id"=>"4",
"compute_attributes"=>{"network"=>"vrid242"}}}}, "apiv"=>"v2"}
2016-03-25 08:35:39 [app] [I] Authorized user admin(Admin User)
2016-03-25 08:35:42 [app] [W] Action failed
> Net::Validations::Error: Invalid MAC
> /usr/share/foreman/lib/net/validations.rb:40:in validate_mac&#39; &gt; /usr/share/foreman/lib/net/dhcp/record.rb:7:ininitialize'
> /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in new&#39; &gt; /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:indhcp_record'
> /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:158:in
queue_remove_dhcp_conflicts&#39; &gt; /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:111:inqueue_dhcp'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:468:in
_run__1545022400610456755__validation__2913233070051402294__callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in__run_callback'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
_run_validation_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:inrun_callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
run_validations!&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:invalid?'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in
valid?&#39; &gt; /usr/share/foreman/app/models/concerns/orchestration.rb:75:invalid?'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:300:in
association_valid?&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:inblock in validate_collection_association'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in
each&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:invalidate_collection_association'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:217:in
block in add_autosave_association_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:ininstance_eval'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:217:in
block in add_autosave_association_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:ininstance_eval'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:in
block in define_non_cyclic_method&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:561:in_run__3201273919907478784__validate__2913233070051402294__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in
__run_callback&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in_run_validate_callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
run_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:227:inrun_validations!'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
block in run_validations!&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:480:in_run__3201273919907478784__validation__2913233070051402294__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in
__run_callback&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in_run_validation_callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
run_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:inrun_validations!'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in
valid?&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:invalid?'
> /usr/share/foreman/app/models/concerns/orchestration.rb:75:in valid?&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:77:inperform_validations'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:50:in
save&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:22:insave'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in
block (2 levels) in save&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:inblock in with_transaction_returning_status'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in
transaction&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:intransaction'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in
with_transaction_returning_status&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:inblock in save'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:252:in
rollback_active_record_state!&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:240:insave'
> /usr/share/foreman/app/models/concerns/foreman/sti.rb:29:in
save_with_type&#39; &gt; /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:96:increate'
>
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in
send_action&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:inprocess_action'
>
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in
process_action&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:inblock in process_action'
>
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in
process_action&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:inblock in process_action'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:584:in
block (5 levels) in _run__658634177585021837__process_action__858862941540031266__callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:inblock in _conditional_callback_around_8145'
> /usr/share/foreman/app/controllers/api/v2/base_controller.rb:151:in
disable_json_root&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in_conditional_callback_around_8145'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:550:in
block (4 levels) in _run__658634177585021837__process_action__858862941540031266__callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:inblock in _conditional_callback_around_8144'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:326:in
around&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:310:in_callback_around_2013'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
_conditional_callback_around_8144&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:527:inblock (3 levels) in
_run__658634177585021837__process_action__858862941540031266__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in
block in _conditional_callback_around_8143&#39; &gt; /usr/share/foreman/app/controllers/concerns/application_shared.rb:13:inset_timezone'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
_conditional_callback_around_8143&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:526:inblock (2 levels) in
_run__658634177585021837__process_action__858862941540031266__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in
block in _conditional_callback_around_8142&#39; &gt; /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:inclear_thread'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
_conditional_callback_around_8142&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:448:inblock in
_run__658634177585021837__process_action__858862941540031266__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in
block in _conditional_callback_around_8141&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:326:inaround'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:310:in
_callback_around_13&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in_conditional_callback_around_8141'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in
_run__658634177585021837__process_action__858862941540031266__callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in__run_callback'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
`_run_process_action_callbacks'
>
/opt/rh/ru

Hello, Tomas,

Thanks for your reply. I'm not 100% which params you're concerned about…
Are you worried about the literals on the compute_type, for example, listed
as VirtualVmxnet3? AFAIK those are the VMWare IDs that are available - is
there a numeric replacement that I should use?

I've compiled the end-to-end data. I had to filter a few details per
managerial request, but here is the back and forth from end-to-end. I
included a sample from the web UI that worked ok at the end, as well, for
comparison to the one generated by Hammer.

I'm including RPM versions, the cli, hammer, and foreman back-and-forth.
At the end, I'm adding the foreman-side of a successful create using the
web UI. Note the addition of ""

From the hammer admin side:

$ rpm -qa|grep hammer
tfm-rubygem-hammer_cli_foreman_tasks-0.0.9-1.fm1_10.el7.noarch
tfm-rubygem-hammer_cli-0.5.1-1.el7.noarch
tfm-rubygem-hammer_cli_foreman-0.5.1-1.el7.noarch

From the foreman side:

foreman-vmware-1.10.1-1.el7.noarch
foreman-console-1.10.1-1.el7.noarch
foreman-1.10.1-1.el7.noarch
tfm-rubygem-rbvmomi-1.8.2-2.el7.noarch
tfm-rubygem-fog-1.34.0-2.el7.noarch
tfm-rubygem-fog-core-1.32.1-2.el7.noarch

CLI (what I said):

$ hammer -d host create
> --environment-id=1
> --architecture-id=1
> --compute-resource-id=1
> --domain-id=4
> --operatingsystem-id=1
> --partition-table-id=60
> --puppet-proxy-id=2
> --hostgroup-title='rentpath/ci_server/lax'
>
–interface="type='Nic::Managed',mac='',primary=true,managed=true,provision=true,domain_id=4,subnet_id=1,compute_type=VirtualVmxnet3,compute_network='Linux
CI Management Servers',compute_attributes={}"
> --subnet-id=1
> --compute-profile=micro
> --compute-attributes="cluster='Equinix Los Angeles Linux
Non-Prod',start=0,cpus=2,memory=2048,path='vm/Linux - ATL -
Non-Production',guest_id=rhel7_64Guest,hardware_version=11,scsi_controller_type=ParaVirtualSCSIController"

>
–volume="datastore=<<FILTERED>>,name='root',thin=false,eager_zero=1,size_gb=20"

> --provision-method=build
> --name='baron-test-003'

Hammer invokation (what hammer thinks I said):

[ INFO 2016-03-07 16:23:34 Modules] Extension module hammer_cli_foreman
(0.5.1) loaded
[ INFO 2016-03-07 16:23:34 HammerCLIForeman::Host::CreateCommand] Called
with options: {"option_managed"=>true, "option_build"=>true,
"option_enabled"=>true, "option_overwrite"=>true,
"option_compute_attributes"=>{"cluster"=>"Equinix Los Angeles Linux
Non-Prod", "start"=>"0", "cpus"=>"2", "memory"=>"2048", "path"=>"vm/Linux -
ATL - Non-Production", "guest_id"=>"rhel7_64Guest",
"hardware_version"=>"11",
"scsi_controller_type"=>"ParaVirtualSCSIController"},
"option_volume_list"=>[{"datastore"=>"<<FILTERED>>", "name"=>"root",
"thin"=>"false", "eager_zero"=>"1", "size_gb"=>"20"}],
"option_interface_list"=>[{"type"=>"Nic::Managed", "mac"=>"",
"primary"=>"true", "managed"=>"true", "provision"=>"true",
"domain_id"=>"4", "subnet_id"=>"1", "compute_type"=>"VirtualVmxnet3",
"compute_network"=>"Linux CI Management Servers",
"compute_attributes"=>"{}"}], "option_provision_method"=>"build",
"option_environment_id"=>1, "option_architecture_id"=>1,
"option_domain_id"=>4, "option_operatingsystem_id"=>1,
"option_ptable_id"=>60, "option_subnet_id"=>1,
"option_compute_resource_id"=>1,
"option_hostgroup_title"=>"rentpath/ci_server/lax",
"option_compute_profile_name"=>"micro", "option_name"=>"baron-test-003",
"option_puppet_proxy_id"=>2}

Foreman post (what hammer told foreman to do):

[ INFO 2016-03-07 16:23:37 API] POST /api/hosts
[DEBUG 2016-03-07 16:23:37 API] Params: {
"host" => {
"name" => "baron-test-003",
"environment_id" => 1,
"architecture_id" => 1,
"domain_id" => 4,
"puppet_proxy_id" => 2,
"operatingsystem_id" => 1,
"ptable_id" => 60,
"subnet_id" => 1,
"compute_resource_id" => 1,
"hostgroup_id" => 14,
"build" => true,
"enabled" => true,
"provision_method" => "build",
"managed" => true,
"compute_profile_id" => 5,
"compute_attributes" => {
"cluster" => "Equinix Los Angeles Linux Non-Prod",
"start" => "0",
"cpus" => "2",
"memory" => "2048",
"path" => "vm/Linux - ATL - Non-Production",
"guest_id" => "rhel7_64Guest",
"hardware_version" => "11",
"scsi_controller_type" => "ParaVirtualSCSIController",
"volumes_attributes" => {
"0" => {
"datastore" => "<<FILTERED>>",
"name" => "root",
"thin" => "false",
"eager_zero" => "1",
"size_gb" => "20"
}
}
},
"overwrite" => true,
"host_parameters_attributes" => {},
"interfaces_attributes" => {
"0" => {
"type" => "Nic::Managed",
"mac" => "",
"primary" => "true",
"managed" => "true",
"provision" => "true",
"domain_id" => "4",
"subnet_id" => "1",
"compute_attributes" => {
"type" => "VirtualVmxnet3",
"network" => "Linux CI Management Servers",
"attributes" => "{}"
}
}
}
}
}

What foreman said back:
[DEBUG 2016-03-07 16:23:37 API] Headers: {}
[DEBUG 2016-03-07 16:23:40 API] 500 Internal Server Error
{
"error" => {
"message" => "Invalid MAC "
}
}
[ERROR 2016-03-07 16:23:40 Exception] Invalid MAC
Could not create the host:
Invalid MAC
[ERROR 2016-03-07 16:23:40 Exception]

What foreman says it got:

{"host"=>{"name"=>"baron-test-003", "environment_id"=>1,
"architecture_id"=>1, "domain_id"=>4, "puppet_proxy_id"=>2,
"operatingsystem_id"=>1, "ptable_id"=>60, "subnet_id"=>1,
"compute_resource_id"=>1, "hostgroup_id"=>14, "build"=>true,
"enabled"=>true, "provision_method"=>"build", "managed"=>true,
"compute_profile_id"=>5, "compute_attributes"=>{"cluster"=>"Equinix Los
Angeles Linux Non-Prod", "start"=>"0", "cpus"=>"2", "memory"=>"2048",
"path"=>"vm/Linux - ATL - Non-Production", "guest_id"=>"rhel7_64Guest",
"hardware_version"=>"11",
"scsi_controller_type"=>"ParaVirtualSCSIController",
"volumes_attributes"=>{"0"=>{"datastore"=>"<<FILTERED>>", "name"=>"root",
"thin"=>"false", "eager_zero"=>"1", "size_gb"=>"20"}}}, "overwrite"=>true,
"host_parameters_attributes"=>{},
"interfaces_attributes"=>{"0"=>{"type"=>"Nic::Managed", "mac"=>"",
"primary"=>"true", "managed"=>"true", "provision"=>"true",
"domain_id"=>"4", "subnet_id"=>"1",
"compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"Linux CI
Management Servers", "attributes"=>"{}"}}}}, "apiv"=>"v2"}

And what it threw up as a result:

2016-03-07 16:23:40 [app] [W] Action failed
> Net::Validations::Error: Invalid MAC
> /usr/share/foreman/lib/net/validations.rb:40:in validate_mac&#39; &gt; /usr/share/foreman/lib/net/dhcp/record.rb:7:ininitialize'
> /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in new&#39; &gt; /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:indhcp_record'
> /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:158:in
queue_remove_dhcp_conflicts&#39; &gt; /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:111:inqueue_dhcp'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:468:in
_run__1819900551699994501__validation__2955275782424232571__callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in__run_callback'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
_run_validation_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:inrun_callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
run_validations!&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:invalid?'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in
valid?&#39; &gt; /usr/share/foreman/app/models/concerns/orchestration.rb:75:invalid?'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:300:in
association_valid?&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:inblock in validate_collection_association'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in
each&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:invalidate_collection_association'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:217:in
block in add_autosave_association_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:ininstance_eval'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:in
block in define_non_cyclic_method&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:561:in_run__4516867619492960946__validate__2955275782424232571__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in
__run_callback&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in_run_validate_callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
run_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:227:inrun_validations!'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
block in run_validations!&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:480:in_run__4516867619492960946__validation__2955275782424232571__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_suppo
rt/callbacks.rb:405:in __run_callback&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in_run_validation_callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
run_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:inrun_validations!'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in
valid?&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:invalid?'
> /usr/share/foreman/app/models/concerns/orchestration.rb:75:in valid?&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:77:inperform_validations'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:50:in
save&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:22:insave'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in
block (2 levels) in save&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:inblock in with_transaction_returning_status'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record
/connection_adapters/abstract/database_statements.rb:192:in transaction&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:intransaction'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in
with_transaction_returning_status&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:inblock in save'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:252:in
rollback_active_record_state!&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:240:insave'
> /usr/share/foreman/app/models/concerns/foreman/sti.rb:29:in
save_with_type&#39; &gt; /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:96:increate'
>
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in
send_action&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:inprocess_action'
>
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in
process_action&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:inblock in process_action'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:584:in
block (5 levels) in _run__798641655495113931__process_ac tion__3605288239170632652__callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:inblock in _conditional_callback_around_8131'
> /usr/share/foreman/app/controllers/api/v2/base_controller.rb:151:in
disable_json_root&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in_conditional_callback_around_8131'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:550:in
block (4 levels) in _run__798641655495113931__process_action__3605288239170632652__callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:inblock in _conditional_callback_around_8130'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:326:in
around&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:310:in_callback_around_2532'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
_conditional_callback_around_8130&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:527:inblock (3 levels) in
_run__798641655495113931__process_action__3605288239170632652__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in
block in _conditional_callback_around_8129&#39; &gt; /usr/share/foreman/app/controllers/concerns/application_shared.rb:13:inset_timezone'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
_conditional_callback_around_8129&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:526:inblock (2 levels) in
_run__798641655495113931__process_action__3605288239170632652__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in
block in _conditional_callback_around_8128&#39; &gt; /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:inclear_thread'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
_conditional_callback_around_8128&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:448:inblock in
_run__798641655495113931__process_action__3605288239170632652__callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in
block in _conditional_callback_around_8127&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:326:inaround'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:310:in
_callback_around_13&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_suppo rt/callbacks.rb:214:in_conditional_callback_around_8127'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:414:in
_run__798641655495113931__process_action__3605288239170632652__callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in__run_callback'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
_run_process_action_callbacks&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:inrun_callbacks'
>
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in
process_action&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:inprocess_action'
>
/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in
block in process_action&#39; &gt; /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:inblock in instrument'
>
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in
`instrument'
>
/opt/rh/r

Hello,
thanks for the logs. As you say, I'm concerned about the compute
attributes in --intefrace. Unfortunately hammer and api only accept ids
for compute attributes [1] (it's filed against oVirt but the problem is
global). There's no way of listing the available ids in hammer yet but
you can do it via api. Check the entrypoints starting with "available_"
in api documentation [2].

Alternatively you can create a host in UI and compare the parameters
from server side log.

T.

[1] Bug #12502: hammer host create using oVirt should use text IDs, not UUIDs - Hammer CLI - Foreman
[2] API documentation

··· On 03/09/2016 05:27 PM, Baron Chandler wrote: > Hello, Tomas, > > Thanks for your reply. I'm not 100% which params you're concerned > about... Are you worried about the literals on the compute_type, for > example, listed as VirtualVmxnet3? AFAIK those are the VMWare IDs that > are available - is there a numeric replacement that I should use? > > I've compiled the end-to-end data. I had to filter a few details per > managerial request, but here is the back and forth from end-to-end. I > included a sample from the web UI that worked ok at the end, as well, > for comparison to the one generated by Hammer. > > > I'm including RPM versions, the cli, hammer, and foreman back-and-forth. > At the end, I'm adding the foreman-side of a successful create using the > web UI. Note the addition of "" > > > > From the hammer admin side: > > $ rpm -qa|grep hammer > tfm-rubygem-hammer_cli_foreman_tasks-0.0.9-1.fm1_10.el7.noarch > tfm-rubygem-hammer_cli-0.5.1-1.el7.noarch > tfm-rubygem-hammer_cli_foreman-0.5.1-1.el7.noarch > > > From the foreman side: > > foreman-vmware-1.10.1-1.el7.noarch > foreman-console-1.10.1-1.el7.noarch > foreman-1.10.1-1.el7.noarch > tfm-rubygem-rbvmomi-1.8.2-2.el7.noarch > tfm-rubygem-fog-1.34.0-2.el7.noarch > tfm-rubygem-fog-core-1.32.1-2.el7.noarch > > > > CLI (what I said): > > $ hammer -d host create \ > > --environment-id=1 \ > > --architecture-id=1 \ > > --compute-resource-id=1 \ > > --domain-id=4 \ > > --operatingsystem-id=1 \ > > --partition-table-id=60 \ > > --puppet-proxy-id=2 \ > > --hostgroup-title='rentpath/ci_server/lax' \ > > > --interface="type='Nic::Managed',mac='',primary=true,managed=true,provision=true,domain_id=4,subnet_id=1,compute_type=VirtualVmxnet3,compute_network='Linux > CI Management Servers',compute_attributes={}" \ > > --subnet-id=1 \ > > --compute-profile=micro \ > > --compute-attributes="cluster='Equinix Los Angeles Linux > Non-Prod',start=0,cpus=2,memory=2048,path='vm/Linux - ATL - > Non-Production',guest_id=rhel7_64Guest,hardware_version=11,scsi_controller_type=ParaVirtualSCSIController" > \ > > > --volume="datastore=<>,name='root',thin=false,eager_zero=1,size_gb=20" > \ > > --provision-method=build \ > > --name='baron-test-003' > > > Hammer invokation (what hammer thinks I said): > > [ INFO 2016-03-07 16:23:34 Modules] Extension module hammer_cli_foreman > (0.5.1) loaded > [ INFO 2016-03-07 16:23:34 HammerCLIForeman::Host::CreateCommand] Called > with options: {"option_managed"=>true, "option_build"=>true, > "option_enabled"=>true, "option_overwrite"=>true, > "option_compute_attributes"=>{"cluster"=>"Equinix Los Angeles Linux > Non-Prod", "start"=>"0", "cpus"=>"2", "memory"=>"2048", > "path"=>"vm/Linux - ATL - Non-Production", "guest_id"=>"rhel7_64Guest", > "hardware_version"=>"11", > "scsi_controller_type"=>"ParaVirtualSCSIController"}, > "option_volume_list"=>[{"datastore"=>"<>", "name"=>"root", > "thin"=>"false", "eager_zero"=>"1", "size_gb"=>"20"}], > "option_interface_list"=>[{"type"=>"Nic::Managed", "mac"=>"", > "primary"=>"true", "managed"=>"true", "provision"=>"true", > "domain_id"=>"4", "subnet_id"=>"1", "compute_type"=>"VirtualVmxnet3", > "compute_network"=>"Linux CI Management Servers", > "compute_attributes"=>"{}"}], "option_provision_method"=>"build", > "option_environment_id"=>1, "option_architecture_id"=>1, > "option_domain_id"=>4, "option_operatingsystem_id"=>1, > "option_ptable_id"=>60, "option_subnet_id"=>1, > "option_compute_resource_id"=>1, > "option_hostgroup_title"=>"rentpath/ci_server/lax", > "option_compute_profile_name"=>"micro", "option_name"=>"baron-test-003", > "option_puppet_proxy_id"=>2} > > > > Foreman post (what hammer told foreman to do): > > [ INFO 2016-03-07 16:23:37 API] POST /api/hosts > [DEBUG 2016-03-07 16:23:37 API] Params: { > "host" => { > "name" => "baron-test-003", > "environment_id" => 1, > "architecture_id" => 1, > "domain_id" => 4, > "puppet_proxy_id" => 2, > "operatingsystem_id" => 1, > "ptable_id" => 60, > "subnet_id" => 1, > "compute_resource_id" => 1, > "hostgroup_id" => 14, > "build" => true, > "enabled" => true, > "provision_method" => "build", > "managed" => true, > "compute_profile_id" => 5, > "compute_attributes" => { > "cluster" => "Equinix Los Angeles Linux Non-Prod", > "start" => "0", > "cpus" => "2", > "memory" => "2048", > "path" => "vm/Linux - ATL - Non-Production", > "guest_id" => "rhel7_64Guest", > "hardware_version" => "11", > "scsi_controller_type" => "ParaVirtualSCSIController", > "volumes_attributes" => { > "0" => { > "datastore" => "<>", > "name" => "root", > "thin" => "false", > "eager_zero" => "1", > "size_gb" => "20" > } > } > }, > "overwrite" => true, > "host_parameters_attributes" => {}, > "interfaces_attributes" => { > "0" => { > "type" => "Nic::Managed", > "mac" => "", > "primary" => "true", > "managed" => "true", > "provision" => "true", > "domain_id" => "4", > "subnet_id" => "1", > "compute_attributes" => { > "type" => "VirtualVmxnet3", > "network" => "Linux CI Management Servers", > "attributes" => "{}" > } > } > } > } > } > > > What foreman said back: > [DEBUG 2016-03-07 16:23:37 API] Headers: {} > [DEBUG 2016-03-07 16:23:40 API] 500 Internal Server Error > { > "error" => { > "message" => "Invalid MAC " > } > } > [ERROR 2016-03-07 16:23:40 Exception] Invalid MAC > Could not create the host: > Invalid MAC > [ERROR 2016-03-07 16:23:40 Exception] > > > What foreman says it got: > > {"host"=>{"name"=>"baron-test-003", "environment_id"=>1, > "architecture_id"=>1, "domain_id"=>4, "puppet_proxy_id"=>2, > "operatingsystem_id"=>1, "ptable_id"=>60, "subnet_id"=>1, > "compute_resource_id"=>1, "hostgroup_id"=>14, "build"=>true, > "enabled"=>true, "provision_method"=>"build", "managed"=>true, > "compute_profile_id"=>5, "compute_attributes"=>{"cluster"=>"Equinix Los > Angeles Linux Non-Prod", "start"=>"0", "cpus"=>"2", "memory"=>"2048", > "path"=>"vm/Linux - ATL - Non-Production", "guest_id"=>"rhel7_64Guest", > "hardware_version"=>"11", > "scsi_controller_type"=>"ParaVirtualSCSIController", > "volumes_attributes"=>{"0"=>{"datastore"=>"<>", > "name"=>"root", "thin"=>"false", "eager_zero"=>"1", "size_gb"=>"20"}}}, > "overwrite"=>true, "host_parameters_attributes"=>{}, > "interfaces_attributes"=>{"0"=>{"type"=>"Nic::Managed", "mac"=>"", > "primary"=>"true", "managed"=>"true", "provision"=>"true", > "domain_id"=>"4", "subnet_id"=>"1", > "compute_attributes"=>{"type"=>"VirtualVmxnet3", "network"=>"Linux CI > Management Servers", "attributes"=>"{}"}}}}, "apiv"=>"v2"} > > And what it threw up as a result: > > 2016-03-07 16:23:40 [app] [W] Action failed > > Net::Validations::Error: Invalid MAC > > /usr/share/foreman/lib/net/validations.rb:40:in `validate_mac' > > /usr/share/foreman/lib/net/dhcp/record.rb:7:in `initialize' > > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in `new' > > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in > `dhcp_record' > > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:158:in > `queue_remove_dhcp_conflicts' > > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:111:in > `queue_dhcp' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:468:in > `_run__1819900551699994501__validation__2955275782424232571__callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in > `__run_callback' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in > `_run_validation_callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in > `run_callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in > `run_validations!' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in > `valid?' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in > `valid?' > > /usr/share/foreman/app/models/concerns/orchestration.rb:75:in `valid?' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:300:in > `association_valid?' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in > `block in validate_collection_association' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in > `each' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in > `validate_collection_association' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:217:in > `block in add_autosave_association_callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:in > `instance_eval' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:in > `block in define_non_cyclic_method' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:561:in > `_run__4516867619492960946__validate__2955275782424232571__callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in > `__run_callback' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in > `_run_validate_callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in > `run_callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:227:in > `run_validations!' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in > `block in run_validations!' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:480:in > `_run__4516867619492960946__validation__2955275782424232571__callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_suppo > rt/callbacks.rb:405:in `__run_callback' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in > `_run_validation_callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in > `run_callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in > `run_validations!' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in > `valid?' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in > `valid?' > > /usr/share/foreman/app/models/concerns/orchestration.rb:75:in `valid?' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:77:in > `perform_validations' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:50:in > `save' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:22:in > `save' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in > `block (2 levels) in save' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:in > `block in with_transaction_returning_status' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record > /connection_adapters/abstract/database_statements.rb:192:in `transaction' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in > `transaction' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in > `with_transaction_returning_status' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in > `block in save' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:252:in > `rollback_active_record_state!' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:240:in > `save' > > /usr/share/foreman/app/models/concerns/foreman/sti.rb:29:in > `save_with_type' > > /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:96:in > `create' > > > /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in > `send_action' > > > /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in > `process_action' > > > /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in > `process_action' > > > /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in > `block in process_action' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:584:in > `block (5 levels) in _run__798641655495113931__process_ac > tion__3605288239170632652__callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in > `block in _conditional_callback_around_8131' > > /usr/share/foreman/app/controllers/api/v2/base_controller.rb:151:in > `disable_json_root' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in > `_conditional_callback_around_8131' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:550:in > `block (4 levels) in > _run__798641655495113931__process_action__3605288239170632652__callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in > `block in _conditional_callback_around_8130' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:326:in > `around' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:310:in > `_callback_around_2532' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in > `_conditional_callback_around_8130' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:527:in > `block (3 levels) in > _run__798641655495113931__process_action__3605288239170632652__callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in > `block in _conditional_callback_around_8129' > > > /usr/share/foreman/app/controllers/concerns/application_shared.rb:13:in > `set_timezone' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in > `_conditional_callback_around_8129' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:526:in > `block (2 levels) in > _run__798641655495113931__process_action__3605288239170632652__callbacks' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in > `block in _conditional_callback_around_8128' > > > /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in > `clear_thread' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in > `_conditional_callback_around_8128' > > > /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_suppor

> #### What I am passing via Hammer:
> hammer -d -v --show-ids host create --compute-resource="pr01vcden2"
> --hostgroup-id=6 --compute-profile="doc_tier" --name=xx00tst046
> --build="yes"
> --compute-attributes="cpus=2,memory_mb=16384,cluster=NPROD,guest_id=centos64Guest,start=1"
> --environment-id=1 --architecture-id=1 --domain-id=1 --puppet-proxy-id=1
> --operatingsystem-id=8 --partition-table-id=59
> --interface="compute_network=vrid242,type=Nic::Managed,domain_id=1,managed=true,primary=true,provision=true,virtual=false,subnet_id=4"
> --volume="datastore=ds_vol_nprod_esx_01_sata_iscsi_06,name=Hard
> Disk,size_gb=40"

Try adding "–overwrite false" to the Hammer command, this may prevent
the error from occurring. The default is true when using the CLI, which
overwrites any conflicting DNS/DHCP records.

> #### production.log
>
>
[…]
> 2016-03-25 08:35:42 [app] [W] Action failed
> > Net::Validations::Error: Invalid MAC
> > /usr/share/foreman/lib/net/validations.rb:40:in validate_mac&#39; &gt; &gt; /usr/share/foreman/lib/net/dhcp/record.rb:7:ininitialize'
> > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in new&#39; &gt; &gt; /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in &gt;dhcp_record'
> > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:158:in
> queue_remove_dhcp_conflicts&#39; &gt; &gt; /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:111:in &gt;queue_dhcp'

This error has just been fixed in
Bug #5859: VM creation fails after IP conflict - Foreman and is scheduled to be
included in 1.11.1 in a few weeks. The patch is small so you could test
it locally if you wanted.

If it works well then I can look at including it in 1.10.4 too (.3 is
about to go out and it's not been heavily tested yet).

··· On 25/03/16 15:14, Scott Fischer wrote:


Dominic Cleal
dominic@cleal.org

OK, cool, will do.

Also, I love your footnoting. It's really awesome.

··· On Tue, Mar 15, 2016 at 6:05 AM, Tomas Strachota wrote:

Hello,
thanks for the logs. As you say, I’m concerned about the compute
attributes in --intefrace. Unfortunately hammer and api only accept ids for
compute attributes [1] (it’s filed against oVirt but the problem is
global). There’s no way of listing the available ids in hammer yet but you
can do it via api. Check the entrypoints starting with “available_” in api
documentation [2].

Alternatively you can create a host in UI and compare the parameters from
server side log.

T.

[1] Bug #12502: hammer host create using oVirt should use text IDs, not UUIDs - Hammer CLI - Foreman
[2] API documentation

On 03/09/2016 05:27 PM, Baron Chandler wrote:

Hello, Tomas,

Thanks for your reply. I’m not 100% which params you’re concerned
about… Are you worried about the literals on the compute_type, for
example, listed as VirtualVmxnet3? AFAIK those are the VMWare IDs that
are available - is there a numeric replacement that I should use?

I’ve compiled the end-to-end data. I had to filter a few details per
managerial request, but here is the back and forth from end-to-end. I
included a sample from the web UI that worked ok at the end, as well,
for comparison to the one generated by Hammer.

I’m including RPM versions, the cli, hammer, and foreman back-and-forth.
At the end, I’m adding the foreman-side of a successful create using the
web UI. Note the addition of “”

From the hammer admin side:

$ rpm -qa|grep hammer
tfm-rubygem-hammer_cli_foreman_tasks-0.0.9-1.fm1_10.el7.noarch
tfm-rubygem-hammer_cli-0.5.1-1.el7.noarch
tfm-rubygem-hammer_cli_foreman-0.5.1-1.el7.noarch

From the foreman side:

foreman-vmware-1.10.1-1.el7.noarch
foreman-console-1.10.1-1.el7.noarch
foreman-1.10.1-1.el7.noarch
tfm-rubygem-rbvmomi-1.8.2-2.el7.noarch
tfm-rubygem-fog-1.34.0-2.el7.noarch
tfm-rubygem-fog-core-1.32.1-2.el7.noarch

CLI (what I said):

$ hammer -d host create \

–environment-id=1
–architecture-id=1
–compute-resource-id=1
–domain-id=4
–operatingsystem-id=1
–partition-table-id=60
–puppet-proxy-id=2
–hostgroup-title=‘rentpath/ci_server/lax’ \

–interface=“type=‘Nic::Managed’,mac=’’,primary=true,managed=true,provision=true,domain_id=4,subnet_id=1,compute_type=VirtualVmxnet3,compute_network=‘Linux
CI Management Servers’,compute_attributes={}” \

–subnet-id=1
–compute-profile=micro
–compute-attributes="cluster=‘Equinix Los Angeles Linux
Non-Prod’,start=0,cpus=2,memory=2048,path='vm/Linux - ATL -

Non-Production’,guest_id=rhel7_64Guest,hardware_version=11,scsi_controller_type=ParaVirtualSCSIController"
\

–volume=“datastore=<>,name=‘root’,thin=false,eager_zero=1,size_gb=20”
\

–provision-method=build
–name=‘baron-test-003’

Hammer invokation (what hammer thinks I said):

[ INFO 2016-03-07 16:23:34 Modules] Extension module hammer_cli_foreman
(0.5.1) loaded
[ INFO 2016-03-07 16:23:34 HammerCLIForeman::Host::CreateCommand] Called
with options: {“option_managed”=>true, “option_build”=>true,
“option_enabled”=>true, “option_overwrite”=>true,
“option_compute_attributes”=>{“cluster”=>“Equinix Los Angeles Linux
Non-Prod”, “start”=>“0”, “cpus”=>“2”, “memory”=>“2048”,
“path”=>“vm/Linux - ATL - Non-Production”, “guest_id”=>“rhel7_64Guest”,
“hardware_version”=>“11”,
“scsi_controller_type”=>“ParaVirtualSCSIController”},
“option_volume_list”=>[{“datastore”=>"<>", “name”=>“root”,
“thin”=>“false”, “eager_zero”=>“1”, “size_gb”=>“20”}],
“option_interface_list”=>[{“type”=>“Nic::Managed”, “mac”=>"",
“primary”=>“true”, “managed”=>“true”, “provision”=>“true”,
“domain_id”=>“4”, “subnet_id”=>“1”, “compute_type”=>“VirtualVmxnet3”,
“compute_network”=>“Linux CI Management Servers”,
“compute_attributes”=>"{}"}], “option_provision_method”=>“build”,
“option_environment_id”=>1, “option_architecture_id”=>1,
“option_domain_id”=>4, “option_operatingsystem_id”=>1,
“option_ptable_id”=>60, “option_subnet_id”=>1,
“option_compute_resource_id”=>1,
“option_hostgroup_title”=>“rentpath/ci_server/lax”,
“option_compute_profile_name”=>“micro”, “option_name”=>“baron-test-003”,
“option_puppet_proxy_id”=>2}

Foreman post (what hammer told foreman to do):

[ INFO 2016-03-07 16:23:37 API] POST /api/hosts
[DEBUG 2016-03-07 16:23:37 API] Params: {
“host” => {
“name” => “baron-test-003”,
“environment_id” => 1,
“architecture_id” => 1,
“domain_id” => 4,
“puppet_proxy_id” => 2,
“operatingsystem_id” => 1,
“ptable_id” => 60,
“subnet_id” => 1,
“compute_resource_id” => 1,
“hostgroup_id” => 14,
“build” => true,
“enabled” => true,
“provision_method” => “build”,
“managed” => true,
“compute_profile_id” => 5,
“compute_attributes” => {
“cluster” => “Equinix Los Angeles Linux
Non-Prod”,
“start” => “0”,
“cpus” => “2”,
“memory” => “2048”,
“path” => “vm/Linux - ATL - Non-Production”,
“guest_id” => “rhel7_64Guest”,
“hardware_version” => “11”,
“scsi_controller_type” => “ParaVirtualSCSIController”,
“volumes_attributes” => {
“0” => {
“datastore” => “<>”,
“name” => “root”,
“thin” => “false”,
“eager_zero” => “1”,
“size_gb” => “20”
}
}
},
“overwrite” => true,
“host_parameters_attributes” => {},
“interfaces_attributes” => {
“0” => {
“type” => “Nic::Managed”,
“mac” => “”,
“primary” => “true”,
“managed” => “true”,
“provision” => “true”,
“domain_id” => “4”,
“subnet_id” => “1”,
“compute_attributes” => {
“type” => “VirtualVmxnet3”,
“network” => “Linux CI Management Servers”,
“attributes” => “{}”
}
}
}
}
}

What foreman said back:
[DEBUG 2016-03-07 16:23:37 API] Headers: {}
[DEBUG 2016-03-07 16:23:40 API] 500 Internal Server Error
{
“error” => {
“message” => "Invalid MAC "
}
}
[ERROR 2016-03-07 16:23:40 Exception] Invalid MAC
Could not create the host:
Invalid MAC
[ERROR 2016-03-07 16:23:40 Exception]

What foreman says it got:

{“host”=>{“name”=>“baron-test-003”, “environment_id”=>1,
“architecture_id”=>1, “domain_id”=>4, “puppet_proxy_id”=>2,
“operatingsystem_id”=>1, “ptable_id”=>60, “subnet_id”=>1,
“compute_resource_id”=>1, “hostgroup_id”=>14, “build”=>true,
“enabled”=>true, “provision_method”=>“build”, “managed”=>true,
“compute_profile_id”=>5, “compute_attributes”=>{“cluster”=>“Equinix Los
Angeles Linux Non-Prod”, “start”=>“0”, “cpus”=>“2”, “memory”=>“2048”,
“path”=>“vm/Linux - ATL - Non-Production”, “guest_id”=>“rhel7_64Guest”,
“hardware_version”=>“11”,
“scsi_controller_type”=>“ParaVirtualSCSIController”,
“volumes_attributes”=>{“0”=>{“datastore”=>"<>",
“name”=>“root”, “thin”=>“false”, “eager_zero”=>“1”, “size_gb”=>“20”}}},
“overwrite”=>true, “host_parameters_attributes”=>{},
“interfaces_attributes”=>{“0”=>{“type”=>“Nic::Managed”, “mac”=>"",
“primary”=>“true”, “managed”=>“true”, “provision”=>“true”,
“domain_id”=>“4”, “subnet_id”=>“1”,
“compute_attributes”=>{“type”=>“VirtualVmxnet3”, “network”=>“Linux CI
Management Servers”, “attributes”=>"{}"}}}}, “apiv”=>“v2”}

And what it threw up as a result:

2016-03-07 16:23:40 [app] [W] Action failed

Net::Validations::Error: Invalid MAC
/usr/share/foreman/lib/net/validations.rb:40:in validate_mac' /usr/share/foreman/lib/net/dhcp/record.rb:7:ininitialize’
/usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in
new' /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:indhcp_record’
/usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:158:in
queue_remove_dhcp_conflicts' /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:111:inqueue_dhcp’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:468:in
`_run__1819900551699994501__validation__2955275782424232571__callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in
`__run_callback’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
`_run_validation_callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
`run_callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
`run_validations!’

/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in
`valid?’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in
`valid?’

/usr/share/foreman/app/models/concerns/orchestration.rb:75:in `valid?’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:300:in
`association_valid?’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in
`block in validate_collection_association’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in
`each’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:289:in
`validate_collection_association’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:217:in
`block in add_autosave_association_callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:in
`instance_eval’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/autosave_association.rb:161:in
`block in define_non_cyclic_method’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:561:in
`_run__4516867619492960946__validate__2955275782424232571__callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in
`__run_callback’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
`_run_validate_callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
`run_callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:227:in
`run_validations!’

/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
`block in run_validations!’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:480:in
`_run__4516867619492960946__validation__2955275782424232571__callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_suppo
rt/callbacks.rb:405:in `__run_callback’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in
`_run_validation_callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in
`run_callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations/callbacks.rb:53:in
`run_validations!’

/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/validations.rb:194:in
`valid?’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:69:in
`valid?’

/usr/share/foreman/app/models/concerns/orchestration.rb:75:in `valid?’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:77:in
`perform_validations’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:50:in
`save’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:22:in
`save’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in
`block (2 levels) in save’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:in
`block in with_transaction_returning_status’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record
/connection_adapters/abstract/database_statements.rb:192:in
`transaction’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in
`transaction’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in
`with_transaction_returning_status’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in
`block in save’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:252:in
`rollback_active_record_state!’

/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:240:in
`save’

/usr/share/foreman/app/models/concerns/foreman/sti.rb:29:in
save_with_type' /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb:96:increate’

/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in
`send_action’

/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in
`process_action’

/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in
`process_action’

/opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in
`block in process_action’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:584:in
`block (5 levels) in _run__798641655495113931__process_ac
tion__3605288239170632652__callbacks’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:215:in
`block in _conditional_callback_around_8131’

/usr/share/foreman/app/controllers/api/v2/base_controller.rb:151:in
`disable_json_root’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:214:in
`_conditional_callback_around_8131’

/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbac

I have upgraded to 1.11.0 for now and the bug still exists. The
work-around of adding –overwrite="false" to the hammercli string
appears to have worked for me - THANKS Dominic!. I will upgrade to 1.11.1
soon and test as well.

··· On Tuesday, March 29, 2016 at 1:52:57 AM UTC-6, Dominic Cleal wrote: > > On 25/03/16 15:14, Scott Fischer wrote: > > #### What I am passing via Hammer: > > hammer -d -v --show-ids host create --compute-resource="pr01vcden2" > > --hostgroup-id=6 --compute-profile="doc_tier" --name=xx00tst046 > > --build="yes" > > > --compute-attributes="cpus=2,memory_mb=16384,cluster=NPROD,guest_id=centos64Guest,start=1" > > > --environment-id=1 --architecture-id=1 --domain-id=1 --puppet-proxy-id=1 > > --operatingsystem-id=8 --partition-table-id=59 > > > --interface="compute_network=vrid242,type=Nic::Managed,domain_id=1,managed=true,primary=true,provision=true,virtual=false,subnet_id=4" > > > --volume="datastore=ds_vol_nprod_esx_01_sata_iscsi_06,name=Hard > > Disk,size_gb=40" > > Try adding "--overwrite false" to the Hammer command, this may prevent > the error from occurring. The default is true when using the CLI, which > overwrites any conflicting DNS/DHCP records. > > > #### production.log > > > > > [..] > > 2016-03-25 08:35:42 [app] [W] Action failed > > > Net::Validations::Error: Invalid MAC > > > /usr/share/foreman/lib/net/validations.rb:40:in `validate_mac' > > > /usr/share/foreman/lib/net/dhcp/record.rb:7:in `initialize' > > > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in > `new' > > > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:20:in > > `dhcp_record' > > > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:158:in > > `queue_remove_dhcp_conflicts' > > > /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:111:in > > `queue_dhcp' > > This error has just been fixed in > http://projects.theforeman.org/issues/5859 and is scheduled to be > included in 1.11.1 in a few weeks. The patch is small so you could test > it locally if you wanted. > > If it works well then I can look at including it in 1.10.4 too (.3 is > about to go out and it's not been heavily tested yet). > > -- > Dominic Cleal > dom...@cleal.org >