>>
>>>>> 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