Using Hammer

Hello all,

One of the new features listed for 1.3 is a CLI, called "hammer". I'm
interested in trying this out.

I am having issues though. This is the output of one of my first attempts:

hammer -u admin -p ********* host list

··· -------------------------------------------------------------------------------- Host list -------------------------------------------------------------------------------- Id: 50 Name: dc1-01.domain.local Operating System Id: 1 Host Group Id: 11 IP: MAC:

And then:

hammer -u admin -p ********* host info --id 50

Host info

interning empty string
Id:

The output of “host list” shows me a host with id 50. Why then does “host
info --id 50” yield an empty output?

I’ve tried the same with the “–name” option, I’ve tried varying with and
without “”, with and without =, ie --id=50, --id=“50” etc…

Nothing yielded something.

What have I overlooked? How do I get information about a host on the
command line?

> Hello all,
>
> One of the new features listed for 1.3 is a CLI, called "hammer". I'm
> interested in trying this out.
>
> I am having issues though. This is the output of one of my first attempts:
>
> hammer -u admin -p ********* host list
> --------------------------------------------------------------------------------
> Host list
> --------------------------------------------------------------------------------
> Id: 50
> Name: dc1-01.domain.local
> Operating System Id: 1
> Host Group Id: 11
> IP:
> MAC:
>
> And then:
>
> hammer -u admin -p ********* host info --id 50
> --------------------------------------------------------------------------------
> Host info
> --------------------------------------------------------------------------------
> interning empty string
> Id:
>
>
> The output of "host list" shows me a host with id 50. Why then does
> "host info --id 50" yield an empty output?
>
> I've tried the same with the "–name" option, I've tried varying with
> and without "", with and without =, ie --id=50, --id="50" etc…
>
> Nothing yielded something.
>
> What have I overlooked? How do I get information about a host on the
> command line?
>
>
Thanks for trying hammer!

In 1.3 the hammer is declared as preview and not feature-complete.
Unfortunately the hosts are most complex and least finished part.
There was quite a lot of progress achieved on hammer since 1.3 so I
recommend to install fresh gems from rubygems.org or nightly repos.
There were some interesting additions merged to the hosts a couple of
days ago and we are going to release new hammer gems tomorrow or Friday
so keep watching. We are preparing series of blog posts on hammer and
will announce them here soon.

Regards,
Martin

··· On 11/06/2013 09:52 AM, Krist van Besien wrote:


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 http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

Today was released a first blog post about Hammer. It covers
installation and a quick setup. See

Regards,
Martin

··· On 11/06/2013 10:56 AM, Martin Bačovský wrote: > On 11/06/2013 09:52 AM, Krist van Besien wrote: >> Hello all, >> >> One of the new features listed for 1.3 is a CLI, called "hammer". I'm >> interested in trying this out. >> >> I am having issues though. This is the output of one of my first >> attempts: >> >> hammer -u admin -p ********* host list >> -------------------------------------------------------------------------------- >> Host list >> -------------------------------------------------------------------------------- >> Id: 50 >> Name: dc1-01.domain.local >> Operating System Id: 1 >> Host Group Id: 11 >> IP: >> MAC: >> >> And then: >> >> hammer -u admin -p ********* host info --id 50 >> -------------------------------------------------------------------------------- >> Host info >> -------------------------------------------------------------------------------- >> interning empty string >> Id: >> >> >> The output of "host list" shows me a host with id 50. Why then does >> "host info --id 50" yield an empty output? >> >> I've tried the same with the "--name" option, I've tried varying with >> and without "", with and without =, ie --id=50, --id="50" etc... >> >> Nothing yielded something. >> >> What have I overlooked? How do I get information about a host on the >> command line? >> >> > Thanks for trying hammer! > > In 1.3 the hammer is declared as preview and not feature-complete. > Unfortunately the hosts are most complex and least finished part. > There was quite a lot of progress achieved on hammer since 1.3 so I > recommend to install fresh gems from rubygems.org or nightly repos. > There were some interesting additions merged to the hosts a couple of > days ago and we are going to release new hammer gems tomorrow or > Friday so keep watching. We are preparing series of blog posts on > hammer and will announce them here soon. > > Regards, > Martin >

Any chance someone can explain how to use the --interface option to add
a second interface to a system within 'hammer host create'? Hammer is
working great for me except adding a second interface. I've been trying
to match what I see for parameters in production.log when using the web
interface, but I've had no luck so far. No errors, but the second
interface just doesn't show up for the host under 'edit'. Currently
using these versions:

rubygem-hammer_cli_foreman-0.0.10-1.el6.noarch
rubygem-hammer_cli-0.0.9-1.el6.noarch

I think I will try out one of the nightlies tomorrow.

··· On 11/19/2013 09:59 AM, Martin Bačovský wrote: > On 11/06/2013 10:56 AM, Martin Bačovský wrote: >> On 11/06/2013 09:52 AM, Krist van Besien wrote: >>> Hello all, >>> >>> One of the new features listed for 1.3 is a CLI, called "hammer". >>> I'm interested in trying this out. >>> >>> I am having issues though. This is the output of one of my first >>> attempts: >>> >>> hammer -u admin -p ********* host list >>> -------------------------------------------------------------------------------- >>> Host list >>> -------------------------------------------------------------------------------- >>> Id: 50 >>> Name: dc1-01.domain.local >>> Operating System Id: 1 >>> Host Group Id: 11 >>> IP: >>> MAC: >>> >>> And then: >>> >>> hammer -u admin -p ********* host info --id 50 >>> -------------------------------------------------------------------------------- >>> Host info >>> -------------------------------------------------------------------------------- >>> interning empty string >>> Id: >>> >>> >>> The output of "host list" shows me a host with id 50. Why then does >>> "host info --id 50" yield an empty output? >>> >>> I've tried the same with the "--name" option, I've tried varying >>> with and without "", with and without =, ie --id=50, --id="50" etc... >>> >>> Nothing yielded something. >>> >>> What have I overlooked? How do I get information about a host on the >>> command line? >>> >>> >> Thanks for trying hammer! >> >> In 1.3 the hammer is declared as preview and not feature-complete. >> Unfortunately the hosts are most complex and least finished part. >> There was quite a lot of progress achieved on hammer since 1.3 so I >> recommend to install fresh gems from rubygems.org or nightly repos. >> There were some interesting additions merged to the hosts a couple of >> days ago and we are going to release new hammer gems tomorrow or >> Friday so keep watching. We are preparing series of blog posts on >> hammer and will announce them here soon. >> >> Regards, >> Martin >> > Today was released a first blog post about Hammer. It covers > installation and a quick setup. See > http://blog.theforeman.org/2013/11/hammer-cli-for-foreman-part-i-setup.html > > Regards, > Martin


Phil Gardner
PGP Key ID 0xFECC890C
OTR Fingerprint 6707E9B8 BD6062D3 5010FE8B 36D614E3 D2F80538

>
>>>> Hello all,
>>>>
>>>> One of the new features listed for 1.3 is a CLI, called "hammer".
>>>> I'm interested in trying this out.
>>>>
>>>> I am having issues though. This is the output of one of my first
>>>> attempts:
>>>>
>>>> hammer -u admin -p ********* host list
>>>> --------------------------------------------------------------------------------
>>>> Host list
>>>> --------------------------------------------------------------------------------
>>>> Id: 50
>>>> Name: dc1-01.domain.local
>>>> Operating System Id: 1
>>>> Host Group Id: 11
>>>> IP:
>>>> MAC:
>>>>
>>>> And then:
>>>>
>>>> hammer -u admin -p ********* host info --id 50
>>>> --------------------------------------------------------------------------------
>>>> Host info
>>>> --------------------------------------------------------------------------------
>>>> interning empty string
>>>> Id:
>>>>
>>>>
>>>> The output of "host list" shows me a host with id 50. Why then does
>>>> "host info --id 50" yield an empty output?
>>>>
>>>> I've tried the same with the "–name" option, I've tried varying
>>>> with and without "", with and without =, ie --id=50, --id="50" etc…
>>>>
>>>> Nothing yielded something.
>>>>
>>>> What have I overlooked? How do I get information about a host on
>>>> the command line?
>>>>
>>>>
>>> Thanks for trying hammer!
>>>
>>> In 1.3 the hammer is declared as preview and not feature-complete.
>>> Unfortunately the hosts are most complex and least finished part.
>>> There was quite a lot of progress achieved on hammer since 1.3 so I
>>> recommend to install fresh gems from rubygems.org or nightly repos.
>>> There were some interesting additions merged to the hosts a couple
>>> of days ago and we are going to release new hammer gems tomorrow or
>>> Friday so keep watching. We are preparing series of blog posts on
>>> hammer and will announce them here soon.
>>>
>>> Regards,
>>> Martin
>>>
>> Today was released a first blog post about Hammer. It covers
>> installation and a quick setup. See
>> http://blog.theforeman.org/2013/11/hammer-cli-for-foreman-part-i-setup.html
>>
>> Regards,
>> Martin
>
> Any chance someone can explain how to use the --interface option to
> add a second interface to a system within 'hammer host create'? Hammer
> is working great for me except adding a second interface. I've been
> trying to match what I see for parameters in production.log when using
> the web interface, but I've had no luck so far. No errors, but the
> second interface just doesn't show up for the host under 'edit'.
> Currently using these versions:
>
> rubygem-hammer_cli_foreman-0.0.10-1.el6.noarch
> rubygem-hammer_cli-0.0.9-1.el6.noarch
>
> I think I will try out one of the nightlies tomorrow.
>
>
The --interface can be used multiple times, one per interface. It should
work with your current versions. If you tried this, did it show any errors?

Martin

··· On 11/19/2013 11:46 PM, Phil Gardner wrote: > On 11/19/2013 09:59 AM, Martin Bačovský wrote: >> On 11/06/2013 10:56 AM, Martin Bačovský wrote: >>> On 11/06/2013 09:52 AM, Krist van Besien wrote:


Phil Gardner
PGP Key ID 0xFECC890C
OTR Fingerprint 6707E9B8 BD6062D3 5010FE8B 36D614E3 D2F80538

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 http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

>>
>>>>> Hello all,
>>>>>
>>>>> One of the new features listed for 1.3 is a CLI, called "hammer".
>>>>> I'm interested in trying this out.
>>>>>
>>>>> I am having issues though. This is the output of one of my first
>>>>> attempts:
>>>>>
>>>>> hammer -u admin -p ********* host list
>>>>> --------------------------------------------------------------------------------
>>>>> Host list
>>>>> --------------------------------------------------------------------------------
>>>>> Id: 50
>>>>> Name: dc1-01.domain.local
>>>>> Operating System Id: 1
>>>>> Host Group Id: 11
>>>>> IP:
>>>>> MAC:
>>>>>
>>>>> And then:
>>>>>
>>>>> hammer -u admin -p ********* host info --id 50
>>>>> --------------------------------------------------------------------------------
>>>>> Host info
>>>>> --------------------------------------------------------------------------------
>>>>> interning empty string
>>>>> Id:
>>>>>
>>>>>
>>>>> The output of "host list" shows me a host with id 50. Why then
>>>>> does "host info --id 50" yield an empty output?
>>>>>
>>>>> I've tried the same with the "–name" option, I've tried varying
>>>>> with and without "", with and without =, ie --id=50, --id="50" etc…
>>>>>
>>>>> Nothing yielded something.
>>>>>
>>>>> What have I overlooked? How do I get information about a host on
>>>>> the command line?
>>>>>
>>>>>
>>>> Thanks for trying hammer!
>>>>
>>>> In 1.3 the hammer is declared as preview and not feature-complete.
>>>> Unfortunately the hosts are most complex and least finished part.
>>>> There was quite a lot of progress achieved on hammer since 1.3 so I
>>>> recommend to install fresh gems from rubygems.org or nightly repos.
>>>> There were some interesting additions merged to the hosts a couple
>>>> of days ago and we are going to release new hammer gems tomorrow or
>>>> Friday so keep watching. We are preparing series of blog posts on
>>>> hammer and will announce them here soon.
>>>>
>>>> Regards,
>>>> Martin
>>>>
>>> Today was released a first blog post about Hammer. It covers
>>> installation and a quick setup. See
>>> http://blog.theforeman.org/2013/11/hammer-cli-for-foreman-part-i-setup.html
>>>
>>> Regards,
>>> Martin
>>
>> Any chance someone can explain how to use the --interface option to
>> add a second interface to a system within 'hammer host create'?
>> Hammer is working great for me except adding a second interface. I've
>> been trying to match what I see for parameters in production.log when
>> using the web interface, but I've had no luck so far. No errors, but
>> the second interface just doesn't show up for the host under 'edit'.
>> Currently using these versions:
>>
>> rubygem-hammer_cli_foreman-0.0.10-1.el6.noarch
>> rubygem-hammer_cli-0.0.9-1.el6.noarch
>>
>> I think I will try out one of the nightlies tomorrow.
>>
>>
> The --interface can be used multiple times, one per interface. It
> should work with your current versions. If you tried this, did it show
> any errors?
>
> Martin
>

Here is the line that I was trying (I'm assuming that the only thing
specified by --interface would be for the second interface, see my
reasoning below). The values I'm using are just from an educated guess
after seeing the log output when using the gui:

> hammer host create --name testhost01 --mac A0:36:9F:28:B9:3C --ip
> 10.13.20.200 --hostgroup-id 1 --domain-id 1 --subnet-id 1 --interface
> _destroy=false,type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain-id=1,subnet-id=1,ip=10.13.30.201,provider=IPMI

Which results in the following output in production.log:
> Started POST "/api/hosts" for 10.13.6.242 at 2013-11-19 23:21:53 +0000
> Processing by Api::V1::HostsController#create as JSON
> Parameters: {"host"=>{"build"=>true, "compute_resource_id"=>nil,
> "subnet_id"=>"1", "ip"=>"10.13.20.200", "ptable_id"=>nil,
> "compute_attributes"=>{"volumes_attributes"=>{},
> "nics_attributes"=>{"0"=>{"ip"=>"10.13.30.201", "domain-id"=>"1",
> "name"=>"testhost01-int2", "_destroy"=>"false", "provider"=>"IPMI",
> "subnet-id"=>"1", "mac"=>"A0:36:9F:28:B9:3D",
> "type"=>"Nic::Managed"}},
> "interfaces_attributes"=>{"0"=>{"ip"=>"10.13.30.201",
> "domain-id"=>"1", "name"=>"testhost01-int2", "_destroy"=>"false",
> "provider"=>"IPMI", "subnet-id"=>"1", "mac"=>"A0:36:9F:28:B9:3D",
> "type"=>"Nic::Managed"}}}, "domain_id"=>"1", "name"=>"testhost01",
> "hostgroup_id"=>"1", "host_parameters_attributes"=>{},
> "enabled"=>true, "managed"=>true, "mac"=>"A0:36:9F:28:B9:3C"}}
> Authorized user admin(Admin User)
> Add the TFTP configuration for testhost01.dealer.ddc
> Fetching required TFTP boot files for testhost01.dealer.ddc
> Rendered api/v1/hosts/create.json.rabl (39.4ms)
> Completed 200 OK in 679ms (Views: 37.6ms | ActiveRecord: 48.2ms)

If I create the host in the web interface, this is the output (second
interface type set to "Interface"):

> Started POST "/hosts" for 10.128.208.63 at 2013-11-19 23:25:08 +0000
> Processing by HostsController#create as /
> Parameters: {"utf8"=>"✓",
> "authenticity_token"=>"IZu47sPWb6tgpfy0SUqSS5DKppfC3cToWKCeMKFKvSg=",
> "host"=>{"name"=>"testhost01", "hostgroup_id"=>"1",
> "compute_resource_id"=>"", "environment_id"=>"1",
> "puppetclass_ids"=>[""], "managed"=>"true",
> "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed",
> "mac"=>"A0:36:9F:28:B9:3C", "domain_id"=>"1", "subnet_id"=>"1",
> "ip"=>"10.13.20.200",
> "interfaces_attributes"=>{"new_interfaces"=>{"_destroy"=>"false",
> "type"=>"Nic::Managed", "mac"=>"", "name"=>"", "domain_id"=>"",
> "ip"=>"", "provider"=>"IPMI"},
> "new_1384903467781"=>{"_destroy"=>"false", "type"=>"Nic::Managed",
> "mac"=>"A0:36:9F:28:B9:3D", "name"=>"testhost01-nfs",
> "domain_id"=>"1", "subnet_id"=>"1", "ip"=>"10.13.30.201",
> "provider"=>"IPMI"}}, "architecture_id"=>"1",
> "operatingsystem_id"=>"2", "provision_method"=>"build", "build"=>"1",
> "medium_id"=>"5", "ptable_id"=>"9", "disk"=>"",
> "root_pass"=>"[FILTERED]", "is_owned_by"=>"", "enabled"=>"0",
> "model_id"=>"", "comment"=>"", "overwrite"=>"false"}}
> Add the TFTP configuration for testhost01.dealer.ddc
> Fetching required TFTP boot files for testhost01.dealer.ddc
> Redirected to https://foreman.wc.dealer.ddc/hosts/testhost01.dealer.ddc
> Completed 302 Found in 415ms (ActiveRecord: 35.1ms)

So under the "interfaces_attributes" object, the first/primary interface
seems to be all blank in the log output. Its not completely clear if I
need to try putting an interface entry for the primary interface when
using hammer, since I already specify the ip/mac/hostgroup/domain for
it. Should I try blank values like the gui is doing?

··· On 11/19/2013 06:11 PM, Martin Bačovský wrote: > On 11/19/2013 11:46 PM, Phil Gardner wrote: >> On 11/19/2013 09:59 AM, Martin Bačovský wrote: >>> On 11/06/2013 10:56 AM, Martin Bačovský wrote: >>>> On 11/06/2013 09:52 AM, Krist van Besien wrote:


Phil Gardner
PGP Key ID 0xFECC890C
OTR Fingerprint 6707E9B8 BD6062D3 5010FE8B 36D614E3 D2F80538

>>>
>>>>>> Hello all,
>>>>>>
>>>>>> One of the new features listed for 1.3 is a CLI, called "hammer".
>>>>>> I'm interested in trying this out.
>>>>>>
>>>>>> I am having issues though. This is the output of one of my first
>>>>>> attempts:
>>>>>>
>>>>>> hammer -u admin -p ********* host list
>>>>>> --------------------------------------------------------------------------------
>>>>>> Host list
>>>>>> --------------------------------------------------------------------------------
>>>>>> Id: 50
>>>>>> Name: dc1-01.domain.local
>>>>>> Operating System Id: 1
>>>>>> Host Group Id: 11
>>>>>> IP:
>>>>>> MAC:
>>>>>>
>>>>>> And then:
>>>>>>
>>>>>> hammer -u admin -p ********* host info --id 50
>>>>>> --------------------------------------------------------------------------------
>>>>>> Host info
>>>>>> --------------------------------------------------------------------------------
>>>>>> interning empty string
>>>>>> Id:
>>>>>>
>>>>>>
>>>>>> The output of "host list" shows me a host with id 50. Why then
>>>>>> does "host info --id 50" yield an empty output?
>>>>>>
>>>>>> I've tried the same with the "–name" option, I've tried varying
>>>>>> with and without "", with and without =, ie --id=50, --id="50" etc…
>>>>>>
>>>>>> Nothing yielded something.
>>>>>>
>>>>>> What have I overlooked? How do I get information about a host on
>>>>>> the command line?
>>>>>>
>>>>>>
>>>>> Thanks for trying hammer!
>>>>>
>>>>> In 1.3 the hammer is declared as preview and not feature-complete.
>>>>> Unfortunately the hosts are most complex and least finished part.
>>>>> There was quite a lot of progress achieved on hammer since 1.3 so I
>>>>> recommend to install fresh gems from rubygems.org or nightly repos.
>>>>> There were some interesting additions merged to the hosts a couple
>>>>> of days ago and we are going to release new hammer gems tomorrow or
>>>>> Friday so keep watching. We are preparing series of blog posts on
>>>>> hammer and will announce them here soon.
>>>>>
>>>>> Regards,
>>>>> Martin
>>>>>
>>>> Today was released a first blog post about Hammer. It covers
>>>> installation and a quick setup. See
>>>> http://blog.theforeman.org/2013/11/hammer-cli-for-foreman-part-i-setup.html
>>>>
>>>> Regards,
>>>> Martin
>>>
>>> Any chance someone can explain how to use the --interface option to
>>> add a second interface to a system within 'hammer host create'?
>>> Hammer is working great for me except adding a second interface. I've
>>> been trying to match what I see for parameters in production.log when
>>> using the web interface, but I've had no luck so far. No errors, but
>>> the second interface just doesn't show up for the host under 'edit'.
>>> Currently using these versions:
>>>
>>> rubygem-hammer_cli_foreman-0.0.10-1.el6.noarch
>>> rubygem-hammer_cli-0.0.9-1.el6.noarch
>>>
>>> I think I will try out one of the nightlies tomorrow.
>>>
>>>
>> The --interface can be used multiple times, one per interface. It
>> should work with your current versions. If you tried this, did it show
>> any errors?
>>
>> Martin
>>
>
> Here is the line that I was trying (I'm assuming that the only thing
> specified by --interface would be for the second interface, see my
> reasoning below). The values I'm using are just from an educated guess
> after seeing the log output when using the gui:
>
>> hammer host create --name testhost01 --mac A0:36:9F:28:B9:3C --ip
>> 10.13.20.200 --hostgroup-id 1 --domain-id 1 --subnet-id 1 --interface
>> _destroy=false,type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain-id=1,subnet-id=1,ip=10.13.30.201,provider=IPMI

Hello Phil,

you're using the options right but I'm afraid you have a typo in the
interface keys. domain_id and subnet_id are supposed to be written with
underscores. Try this example:

–interface="type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain_id=1,subnet_id=1,ip=10.13.30.201,provider=IPMI"

I updated our brief host creation docs with a list of interface keys for
bare metal:

Tomas

··· On 11/20/2013 12:30 AM, Phil Gardner wrote: > On 11/19/2013 06:11 PM, Martin Bačovský wrote: >> On 11/19/2013 11:46 PM, Phil Gardner wrote: >>> On 11/19/2013 09:59 AM, Martin Bačovský wrote: >>>> On 11/06/2013 10:56 AM, Martin Bačovský wrote: >>>>> On 11/06/2013 09:52 AM, Krist van Besien wrote:

Which results in the following output in production.log:

Started POST “/api/hosts” for 10.13.6.242 at 2013-11-19 23:21:53 +0000
Processing by Api::V1::HostsController#create as JSON
Parameters: {“host”=>{“build”=>true, “compute_resource_id”=>nil,
“subnet_id”=>“1”, “ip”=>“10.13.20.200”, “ptable_id”=>nil,
“compute_attributes”=>{“volumes_attributes”=>{},
“nics_attributes”=>{“0”=>{“ip”=>“10.13.30.201”, “domain-id”=>“1”,
“name”=>“testhost01-int2”, “_destroy”=>“false”, “provider”=>“IPMI”,
“subnet-id”=>“1”, “mac”=>“A0:36:9F:28:B9:3D”,
“type”=>“Nic::Managed”}},
“interfaces_attributes”=>{“0”=>{“ip”=>“10.13.30.201”,
“domain-id”=>“1”, “name”=>“testhost01-int2”, “_destroy”=>“false”,
“provider”=>“IPMI”, “subnet-id”=>“1”, “mac”=>“A0:36:9F:28:B9:3D”,
“type”=>“Nic::Managed”}}}, “domain_id”=>“1”, “name”=>“testhost01”,
“hostgroup_id”=>“1”, “host_parameters_attributes”=>{},
“enabled”=>true, “managed”=>true, “mac”=>“A0:36:9F:28:B9:3C”}}
Authorized user admin(Admin User)
Add the TFTP configuration for testhost01.dealer.ddc
Fetching required TFTP boot files for testhost01.dealer.ddc
Rendered api/v1/hosts/create.json.rabl (39.4ms)
Completed 200 OK in 679ms (Views: 37.6ms | ActiveRecord: 48.2ms)

If I create the host in the web interface, this is the output (second
interface type set to “Interface”):

Started POST “/hosts” for 10.128.208.63 at 2013-11-19 23:25:08 +0000
Processing by HostsController#create as /
Parameters: {“utf8”=>“✓”,
“authenticity_token”=>“IZu47sPWb6tgpfy0SUqSS5DKppfC3cToWKCeMKFKvSg=”,
“host”=>{“name”=>“testhost01”, “hostgroup_id”=>“1”,
“compute_resource_id”=>"", “environment_id”=>“1”,
“puppetclass_ids”=>[""], “managed”=>“true”,
“progress_report_id”=>"[FILTERED]", “type”=>“Host::Managed”,
“mac”=>“A0:36:9F:28:B9:3C”, “domain_id”=>“1”, “subnet_id”=>“1”,
“ip”=>“10.13.20.200”,
“interfaces_attributes”=>{“new_interfaces”=>{"_destroy"=>“false”,
“type”=>“Nic::Managed”, “mac”=>"", “name”=>"", “domain_id”=>"",
“ip”=>"", “provider”=>“IPMI”},
“new_1384903467781”=>{"_destroy"=>“false”, “type”=>“Nic::Managed”,
“mac”=>“A0:36:9F:28:B9:3D”, “name”=>“testhost01-nfs”,
“domain_id”=>“1”, “subnet_id”=>“1”, “ip”=>“10.13.30.201”,
“provider”=>“IPMI”}}, “architecture_id”=>“1”,
“operatingsystem_id”=>“2”, “provision_method”=>“build”, “build”=>“1”,
“medium_id”=>“5”, “ptable_id”=>“9”, “disk”=>"",
“root_pass”=>"[FILTERED]", “is_owned_by”=>"", “enabled”=>“0”,
“model_id”=>"", “comment”=>"", “overwrite”=>“false”}}
Add the TFTP configuration for testhost01.dealer.ddc
Fetching required TFTP boot files for testhost01.dealer.ddc
Redirected to https://foreman.wc.dealer.ddc/hosts/testhost01.dealer.ddc
Completed 302 Found in 415ms (ActiveRecord: 35.1ms)

So under the “interfaces_attributes” object, the first/primary interface
seems to be all blank in the log output. Its not completely clear if I
need to try putting an interface entry for the primary interface when
using hammer, since I already specify the ip/mac/hostgroup/domain for
it. Should I try blank values like the gui is doing?


Phil Gardner
PGP Key ID 0xFECC890C
OTR Fingerprint 6707E9B8 BD6062D3 5010FE8B 36D614E3 D2F80538


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 http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

Ah, that is slightly confusing since the standard options under create
use hyphens :slight_smile:

But I'm still having trouble with this and can't seem to get it to work
for the second interface. Is there a way to get foreman to output some
more information to production.log? I also tried to specify --interface
twice, hoping that it would use the key=values in the second set for the
second interface:

hammer host create --name=testhost01 --hostgroup-id=1
–interface="type=Nic::Managed"
–interface="type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain_id=1,subnet_id=1,ip=10.13.30.201"
–enabled=false --mac=A0:36:9F:28:B9:3C --ip=10.13.20.200

Here is the ruby object from the logs reduced to json:

{
"host": {
"hostgroup_id": "1",
"mac": "A0:36:9F:28:B9:3C",
"ptable_id": null,
"enabled": false,
"host_parameters_attributes": {},
"compute_resource_id": null,
"managed":true,
"build":true,
"name":"testhost01",
"compute_attributes":{
"volumes_attributes":{},
"nics_attributes":{
"1":{
"domain_id":"1",
"mac":"A0:36:9F:28:B9:3D",
"type":"Nic::Managed",
"name":"testhost01-int2",
"subnet_id":"1",
"ip":"10.13.30.201"
},
"0":{
"type":"Nic::Managed"
}
},
"interfaces_attributes":{
"1":{
"domain_id":"1",
"mac":"A0:36:9F:28:B9:3D",
"type":"Nic::Managed",
"name":"testhost01-int2",
"subnet_id":"1",
"ip":"10.13.30.201"
},
"0":{
"type":"Nic::Managed"
}
}
},
"ip":"10.13.20.200"
}
}

So hammer is using the nics_attributes array and the
interfaces_attributes array, and seems to be matching the values in the
correct order for what I want.

Are some of the attribute descriptions missing from the API doc
http://theforeman.org/api/apidoc/hosts/create.html ?

Any other debugging/troubleshooting suggestions?

··· On 11/20/2013 03:48 AM, Tomas Strachota wrote: > On 11/20/2013 12:30 AM, Phil Gardner wrote: >> On 11/19/2013 06:11 PM, Martin Bačovský wrote: >>> On 11/19/2013 11:46 PM, Phil Gardner wrote: >>>> >>>> On 11/19/2013 09:59 AM, Martin Bačovský wrote: >>>>> On 11/06/2013 10:56 AM, Martin Bačovský wrote: >>>>>> On 11/06/2013 09:52 AM, Krist van Besien wrote: >>>>>>> Hello all, >>>>>>> >>>>>>> One of the new features listed for 1.3 is a CLI, called "hammer". >>>>>>> I'm interested in trying this out. >>>>>>> >>>>>>> I am having issues though. This is the output of one of my first >>>>>>> attempts: >>>>>>> >>>>>>> hammer -u admin -p ********* host list >>>>>>> -------------------------------------------------------------------------------- >>>>>>> >>>>>>> Host list >>>>>>> -------------------------------------------------------------------------------- >>>>>>> >>>>>>> Id: 50 >>>>>>> Name: dc1-01.domain.local >>>>>>> Operating System Id: 1 >>>>>>> Host Group Id: 11 >>>>>>> IP: >>>>>>> MAC: >>>>>>> >>>>>>> And then: >>>>>>> >>>>>>> hammer -u admin -p ********* host info --id 50 >>>>>>> -------------------------------------------------------------------------------- >>>>>>> >>>>>>> Host info >>>>>>> -------------------------------------------------------------------------------- >>>>>>> >>>>>>> interning empty string >>>>>>> Id: >>>>>>> >>>>>>> >>>>>>> The output of "host list" shows me a host with id 50. Why then >>>>>>> does "host info --id 50" yield an empty output? >>>>>>> >>>>>>> I've tried the same with the "--name" option, I've tried varying >>>>>>> with and without "", with and without =, ie --id=50, --id="50" >>>>>>> etc... >>>>>>> >>>>>>> Nothing yielded something. >>>>>>> >>>>>>> What have I overlooked? How do I get information about a host on >>>>>>> the command line? >>>>>>> >>>>>>> >>>>>> Thanks for trying hammer! >>>>>> >>>>>> In 1.3 the hammer is declared as preview and not feature-complete. >>>>>> Unfortunately the hosts are most complex and least finished part. >>>>>> There was quite a lot of progress achieved on hammer since 1.3 so I >>>>>> recommend to install fresh gems from rubygems.org or nightly repos. >>>>>> There were some interesting additions merged to the hosts a couple >>>>>> of days ago and we are going to release new hammer gems tomorrow or >>>>>> Friday so keep watching. We are preparing series of blog posts on >>>>>> hammer and will announce them here soon. >>>>>> >>>>>> Regards, >>>>>> Martin >>>>>> >>>>> Today was released a first blog post about Hammer. It covers >>>>> installation and a quick setup. See >>>>> http://blog.theforeman.org/2013/11/hammer-cli-for-foreman-part-i-setup.html >>>>> >>>>> >>>>> Regards, >>>>> Martin >>>> >>>> Any chance someone can explain how to use the --interface option to >>>> add a second interface to a system within 'hammer host create'? >>>> Hammer is working great for me except adding a second interface. I've >>>> been trying to match what I see for parameters in production.log when >>>> using the web interface, but I've had no luck so far. No errors, but >>>> the second interface just doesn't show up for the host under 'edit'. >>>> Currently using these versions: >>>> >>>> rubygem-hammer_cli_foreman-0.0.10-1.el6.noarch >>>> rubygem-hammer_cli-0.0.9-1.el6.noarch >>>> >>>> I think I will try out one of the nightlies tomorrow. >>>> >>>> >>> The --interface can be used multiple times, one per interface. It >>> should work with your current versions. If you tried this, did it show >>> any errors? >>> >>> Martin >>> >> >> Here is the line that I was trying (I'm assuming that the only thing >> specified by --interface would be for the second interface, see my >> reasoning below). The values I'm using are just from an educated guess >> after seeing the log output when using the gui: >> >>> hammer host create --name testhost01 --mac A0:36:9F:28:B9:3C --ip >>> 10.13.20.200 --hostgroup-id 1 --domain-id 1 --subnet-id 1 --interface >>> _destroy=false,type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain-id=1,subnet-id=1,ip=10.13.30.201,provider=IPMI >>> > > Hello Phil, > > you're using the options right but I'm afraid you have a typo in the > interface keys. domain_id and subnet_id are supposed to be written with > underscores. Try this example: > > --interface="type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain_id=1,subnet_id=1,ip=10.13.30.201,provider=IPMI" > > > I updated our brief host creation docs with a list of interface keys for > bare metal: > https://github.com/theforeman/hammer-cli-foreman/blob/master/doc/host_create.md#bare-metal > > > Tomas >


Phil Gardner
PGP Key ID 0xFECC890C
OTR Fingerprint 6707E9B8 BD6062D3 5010FE8B 36D614E3 D2F80538

FWIW, here is the json from adding a host through the web interface with
all of the same options from the hammer json

{
"host":{
"name":"testhost01",
"hostgroup_id":"1",
"compute_resource_id":"",
"environment_id":"1",
"puppetclass_ids":[""],
"managed":"true",
"progress_report_id":"[FILTERED]",
"type":"Host::Managed",
"mac":"A0:36:9F:28:B9:3C",
"domain_id":"1",
"subnet_id":"1",
"ip":"10.13…20.200",
"interfaces_attributes":{
"new_interfaces":{
"_destroy":"false",
"type":"Nic::Managed",
"mac":"",
"name":"",
"domain_id":"",
"ip":"",
"provider":"IPMI"
},
"new_1384982950401":{
"_destroy":"false",
"type":"Nic::Managed",
"mac":"A0:36:9F:28:B9:3D",
"name":"testhost01-nfs",
"domain_id":"1",
"subnet_id":"1",
"ip":"10.13.30.201",
"provider":"IPMI"
}
},
"architecture_id":"1",
"operatingsystem_id":"2",
"provision_method":"build",
"build":"1",
"medium_id":"5",
"ptable_id":"9",
"disk":"",
"root_pass":"[FILTERED]",
"is_owned_by":"",
"enabled":"0",
"model_id":"",
"comment":"",
"overwrite":"false"
}
}

··· On 11/20/2013 11:56 AM, Phil Gardner wrote: > On 11/20/2013 03:48 AM, Tomas Strachota wrote: >> On 11/20/2013 12:30 AM, Phil Gardner wrote: >>> On 11/19/2013 06:11 PM, Martin Bačovský wrote: >>>> On 11/19/2013 11:46 PM, Phil Gardner wrote: >>>>> >>>>> On 11/19/2013 09:59 AM, Martin Bačovský wrote: >>>>>> On 11/06/2013 10:56 AM, Martin Bačovský wrote: >>>>>>> On 11/06/2013 09:52 AM, Krist van Besien wrote: >>>>>>>> Hello all, >>>>>>>> >>>>>>>> One of the new features listed for 1.3 is a CLI, called "hammer". >>>>>>>> I'm interested in trying this out. >>>>>>>> >>>>>>>> I am having issues though. This is the output of one of my first >>>>>>>> attempts: >>>>>>>> >>>>>>>> hammer -u admin -p ********* host list >>>>>>>> -------------------------------------------------------------------------------- >>>>>>>> >>>>>>>> >>>>>>>> Host list >>>>>>>> -------------------------------------------------------------------------------- >>>>>>>> >>>>>>>> >>>>>>>> Id: 50 >>>>>>>> Name: dc1-01.domain.local >>>>>>>> Operating System Id: 1 >>>>>>>> Host Group Id: 11 >>>>>>>> IP: >>>>>>>> MAC: >>>>>>>> >>>>>>>> And then: >>>>>>>> >>>>>>>> hammer -u admin -p ********* host info --id 50 >>>>>>>> -------------------------------------------------------------------------------- >>>>>>>> >>>>>>>> >>>>>>>> Host info >>>>>>>> -------------------------------------------------------------------------------- >>>>>>>> >>>>>>>> >>>>>>>> interning empty string >>>>>>>> Id: >>>>>>>> >>>>>>>> >>>>>>>> The output of "host list" shows me a host with id 50. Why then >>>>>>>> does "host info --id 50" yield an empty output? >>>>>>>> >>>>>>>> I've tried the same with the "--name" option, I've tried varying >>>>>>>> with and without "", with and without =, ie --id=50, --id="50" >>>>>>>> etc... >>>>>>>> >>>>>>>> Nothing yielded something. >>>>>>>> >>>>>>>> What have I overlooked? How do I get information about a host on >>>>>>>> the command line? >>>>>>>> >>>>>>>> >>>>>>> Thanks for trying hammer! >>>>>>> >>>>>>> In 1.3 the hammer is declared as preview and not feature-complete. >>>>>>> Unfortunately the hosts are most complex and least finished part. >>>>>>> There was quite a lot of progress achieved on hammer since 1.3 so I >>>>>>> recommend to install fresh gems from rubygems.org or nightly repos. >>>>>>> There were some interesting additions merged to the hosts a couple >>>>>>> of days ago and we are going to release new hammer gems tomorrow or >>>>>>> Friday so keep watching. We are preparing series of blog posts on >>>>>>> hammer and will announce them here soon. >>>>>>> >>>>>>> Regards, >>>>>>> Martin >>>>>>> >>>>>> Today was released a first blog post about Hammer. It covers >>>>>> installation and a quick setup. See >>>>>> http://blog.theforeman.org/2013/11/hammer-cli-for-foreman-part-i-setup.html >>>>>> >>>>>> >>>>>> >>>>>> Regards, >>>>>> Martin >>>>> >>>>> Any chance someone can explain how to use the --interface option to >>>>> add a second interface to a system within 'hammer host create'? >>>>> Hammer is working great for me except adding a second interface. I've >>>>> been trying to match what I see for parameters in production.log when >>>>> using the web interface, but I've had no luck so far. No errors, but >>>>> the second interface just doesn't show up for the host under 'edit'. >>>>> Currently using these versions: >>>>> >>>>> rubygem-hammer_cli_foreman-0.0.10-1.el6.noarch >>>>> rubygem-hammer_cli-0.0.9-1.el6.noarch >>>>> >>>>> I think I will try out one of the nightlies tomorrow. >>>>> >>>>> >>>> The --interface can be used multiple times, one per interface. It >>>> should work with your current versions. If you tried this, did it show >>>> any errors? >>>> >>>> Martin >>>> >>> >>> Here is the line that I was trying (I'm assuming that the only thing >>> specified by --interface would be for the second interface, see my >>> reasoning below). The values I'm using are just from an educated guess >>> after seeing the log output when using the gui: >>> >>>> hammer host create --name testhost01 --mac A0:36:9F:28:B9:3C --ip >>>> 10.13.20.200 --hostgroup-id 1 --domain-id 1 --subnet-id 1 --interface >>>> _destroy=false,type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain-id=1,subnet-id=1,ip=10.13.30.201,provider=IPMI >>>> >>>> >> >> Hello Phil, >> >> you're using the options right but I'm afraid you have a typo in the >> interface keys. domain_id and subnet_id are supposed to be written with >> underscores. Try this example: >> >> --interface="type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain_id=1,subnet_id=1,ip=10.13.30.201,provider=IPMI" >> >> >> >> I updated our brief host creation docs with a list of interface keys for >> bare metal: >> https://github.com/theforeman/hammer-cli-foreman/blob/master/doc/host_create.md#bare-metal >> >> >> >> Tomas >> > > Ah, that is slightly confusing since the standard options under create > use hyphens :) > > But I'm still having trouble with this and can't seem to get it to work > for the second interface. Is there a way to get foreman to output some > more information to production.log? I also tried to specify --interface > twice, hoping that it would use the key=values in the second set for the > second interface: > > hammer host create --name=testhost01 --hostgroup-id=1 > --interface="type=Nic::Managed" > --interface="type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain_id=1,subnet_id=1,ip=10.13.30.201" > --enabled=false --mac=A0:36:9F:28:B9:3C --ip=10.13.20.200 > > Here is the ruby object from the logs reduced to json: > > { > "host": { > "hostgroup_id": "1", > "mac": "A0:36:9F:28:B9:3C", > "ptable_id": null, > "enabled": false, > "host_parameters_attributes": {}, > "compute_resource_id": null, > "managed":true, > "build":true, > "name":"testhost01", > "compute_attributes":{ > "volumes_attributes":{}, > "nics_attributes":{ > "1":{ > "domain_id":"1", > "mac":"A0:36:9F:28:B9:3D", > "type":"Nic::Managed", > "name":"testhost01-int2", > "subnet_id":"1", > "ip":"10.13.30.201" > }, > "0":{ > "type":"Nic::Managed" > } > }, > "interfaces_attributes":{ > "1":{ > "domain_id":"1", > "mac":"A0:36:9F:28:B9:3D", > "type":"Nic::Managed", > "name":"testhost01-int2", > "subnet_id":"1", > "ip":"10.13.30.201" > }, > "0":{ > "type":"Nic::Managed" > } > } > }, > "ip":"10.13.20.200" > } > } > > So hammer is using the nics_attributes array and the > interfaces_attributes array, and seems to be matching the values in the > correct order for what I want. > > Are some of the attribute descriptions missing from the API doc > http://theforeman.org/api/apidoc/hosts/create.html ? > > Any other debugging/troubleshooting suggestions? >


Phil Gardner
PGP Key ID 0xFECC890C
OTR Fingerprint 6707E9B8 BD6062D3 5010FE8B 36D614E3 D2F80538

I found out this is a bug. Api expects the attributes in different hash
for bare metal machines as you described.
I opened an issue for that: Bug #3713: Unable to set network interfaces for bare metal hosts - Hammer CLI - Foreman
I'll try to fix it soon.

T.

··· On 11/20/2013 10:50 PM, Phil Gardner wrote: > On 11/20/2013 11:56 AM, Phil Gardner wrote: >> On 11/20/2013 03:48 AM, Tomas Strachota wrote: >>> On 11/20/2013 12:30 AM, Phil Gardner wrote: >>>> On 11/19/2013 06:11 PM, Martin Bačovský wrote: >>>>> On 11/19/2013 11:46 PM, Phil Gardner wrote: >>>>>> >>>>>> On 11/19/2013 09:59 AM, Martin Bačovský wrote: >>>>>>> On 11/06/2013 10:56 AM, Martin Bačovský wrote: >>>>>>>> On 11/06/2013 09:52 AM, Krist van Besien wrote: >>>>>>>>> Hello all, >>>>>>>>> >>>>>>>>> One of the new features listed for 1.3 is a CLI, called "hammer". >>>>>>>>> I'm interested in trying this out. >>>>>>>>> >>>>>>>>> I am having issues though. This is the output of one of my first >>>>>>>>> attempts: >>>>>>>>> >>>>>>>>> hammer -u admin -p ********* host list >>>>>>>>> -------------------------------------------------------------------------------- >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Host list >>>>>>>>> -------------------------------------------------------------------------------- >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Id: 50 >>>>>>>>> Name: dc1-01.domain.local >>>>>>>>> Operating System Id: 1 >>>>>>>>> Host Group Id: 11 >>>>>>>>> IP: >>>>>>>>> MAC: >>>>>>>>> >>>>>>>>> And then: >>>>>>>>> >>>>>>>>> hammer -u admin -p ********* host info --id 50 >>>>>>>>> -------------------------------------------------------------------------------- >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Host info >>>>>>>>> -------------------------------------------------------------------------------- >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> interning empty string >>>>>>>>> Id: >>>>>>>>> >>>>>>>>> >>>>>>>>> The output of "host list" shows me a host with id 50. Why then >>>>>>>>> does "host info --id 50" yield an empty output? >>>>>>>>> >>>>>>>>> I've tried the same with the "--name" option, I've tried varying >>>>>>>>> with and without "", with and without =, ie --id=50, --id="50" >>>>>>>>> etc... >>>>>>>>> >>>>>>>>> Nothing yielded something. >>>>>>>>> >>>>>>>>> What have I overlooked? How do I get information about a host on >>>>>>>>> the command line? >>>>>>>>> >>>>>>>>> >>>>>>>> Thanks for trying hammer! >>>>>>>> >>>>>>>> In 1.3 the hammer is declared as preview and not feature-complete. >>>>>>>> Unfortunately the hosts are most complex and least finished part. >>>>>>>> There was quite a lot of progress achieved on hammer since 1.3 so I >>>>>>>> recommend to install fresh gems from rubygems.org or nightly repos. >>>>>>>> There were some interesting additions merged to the hosts a couple >>>>>>>> of days ago and we are going to release new hammer gems tomorrow or >>>>>>>> Friday so keep watching. We are preparing series of blog posts on >>>>>>>> hammer and will announce them here soon. >>>>>>>> >>>>>>>> Regards, >>>>>>>> Martin >>>>>>>> >>>>>>> Today was released a first blog post about Hammer. It covers >>>>>>> installation and a quick setup. See >>>>>>> http://blog.theforeman.org/2013/11/hammer-cli-for-foreman-part-i-setup.html >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Regards, >>>>>>> Martin >>>>>> >>>>>> Any chance someone can explain how to use the --interface option to >>>>>> add a second interface to a system within 'hammer host create'? >>>>>> Hammer is working great for me except adding a second interface. I've >>>>>> been trying to match what I see for parameters in production.log when >>>>>> using the web interface, but I've had no luck so far. No errors, but >>>>>> the second interface just doesn't show up for the host under 'edit'. >>>>>> Currently using these versions: >>>>>> >>>>>> rubygem-hammer_cli_foreman-0.0.10-1.el6.noarch >>>>>> rubygem-hammer_cli-0.0.9-1.el6.noarch >>>>>> >>>>>> I think I will try out one of the nightlies tomorrow. >>>>>> >>>>>> >>>>> The --interface can be used multiple times, one per interface. It >>>>> should work with your current versions. If you tried this, did it show >>>>> any errors? >>>>> >>>>> Martin >>>>> >>>> >>>> Here is the line that I was trying (I'm assuming that the only thing >>>> specified by --interface would be for the second interface, see my >>>> reasoning below). The values I'm using are just from an educated guess >>>> after seeing the log output when using the gui: >>>> >>>>> hammer host create --name testhost01 --mac A0:36:9F:28:B9:3C --ip >>>>> 10.13.20.200 --hostgroup-id 1 --domain-id 1 --subnet-id 1 --interface >>>>> _destroy=false,type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain-id=1,subnet-id=1,ip=10.13.30.201,provider=IPMI >>>>> >>>>> >>>>> >>> >>> Hello Phil, >>> >>> you're using the options right but I'm afraid you have a typo in the >>> interface keys. domain_id and subnet_id are supposed to be written with >>> underscores. Try this example: >>> >>> --interface="type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain_id=1,subnet_id=1,ip=10.13.30.201,provider=IPMI" >>> >>> >>> >>> >>> I updated our brief host creation docs with a list of interface keys for >>> bare metal: >>> https://github.com/theforeman/hammer-cli-foreman/blob/master/doc/host_create.md#bare-metal >>> >>> >>> >>> >>> Tomas >>> >> >> Ah, that is slightly confusing since the standard options under create >> use hyphens :) >> >> But I'm still having trouble with this and can't seem to get it to work >> for the second interface. Is there a way to get foreman to output some >> more information to production.log? I also tried to specify --interface >> twice, hoping that it would use the key=values in the second set for the >> second interface: >> >> hammer host create --name=testhost01 --hostgroup-id=1 >> --interface="type=Nic::Managed" >> --interface="type=Nic::Managed,mac=A0:36:9F:28:B9:3D,name=testhost01-int2,domain_id=1,subnet_id=1,ip=10.13.30.201" >> >> --enabled=false --mac=A0:36:9F:28:B9:3C --ip=10.13.20.200 >> >> Here is the ruby object from the logs reduced to json: >> >> { >> "host": { >> "hostgroup_id": "1", >> "mac": "A0:36:9F:28:B9:3C", >> "ptable_id": null, >> "enabled": false, >> "host_parameters_attributes": {}, >> "compute_resource_id": null, >> "managed":true, >> "build":true, >> "name":"testhost01", >> "compute_attributes":{ >> "volumes_attributes":{}, >> "nics_attributes":{ >> "1":{ >> "domain_id":"1", >> "mac":"A0:36:9F:28:B9:3D", >> "type":"Nic::Managed", >> "name":"testhost01-int2", >> "subnet_id":"1", >> "ip":"10.13.30.201" >> }, >> "0":{ >> "type":"Nic::Managed" >> } >> }, >> "interfaces_attributes":{ >> "1":{ >> "domain_id":"1", >> "mac":"A0:36:9F:28:B9:3D", >> "type":"Nic::Managed", >> "name":"testhost01-int2", >> "subnet_id":"1", >> "ip":"10.13.30.201" >> }, >> "0":{ >> "type":"Nic::Managed" >> } >> } >> }, >> "ip":"10.13.20.200" >> } >> } >> >> So hammer is using the nics_attributes array and the >> interfaces_attributes array, and seems to be matching the values in the >> correct order for what I want. >> >> Are some of the attribute descriptions missing from the API doc >> http://theforeman.org/api/apidoc/hosts/create.html ? >> >> Any other debugging/troubleshooting suggestions? >> > > FWIW, here is the json from adding a host through the web interface with > all of the same options from the hammer json > > { > "host":{ > "name":"testhost01", > "hostgroup_id":"1", > "compute_resource_id":"", > "environment_id":"1", > "puppetclass_ids":[""], > "managed":"true", > "progress_report_id":"[FILTERED]", > "type":"Host::Managed", > "mac":"A0:36:9F:28:B9:3C", > "domain_id":"1", > "subnet_id":"1", > "ip":"10.13..20.200", > "interfaces_attributes":{ > "new_interfaces":{ > "_destroy":"false", > "type":"Nic::Managed", > "mac":"", > "name":"", > "domain_id":"", > "ip":"", > "provider":"IPMI" > }, > "new_1384982950401":{ > "_destroy":"false", > "type":"Nic::Managed", > "mac":"A0:36:9F:28:B9:3D", > "name":"testhost01-nfs", > "domain_id":"1", > "subnet_id":"1", > "ip":"10.13.30.201", > "provider":"IPMI" > } > }, > "architecture_id":"1", > "operatingsystem_id":"2", > "provision_method":"build", > "build":"1", > "medium_id":"5", > "ptable_id":"9", > "disk":"", > "root_pass":"[FILTERED]", > "is_owned_by":"", > "enabled":"0", > "model_id":"", > "comment":"", > "overwrite":"false" > } > } >