Get the host['ip'] variable to customization spec

Hello ,

I've been added ‘customization_spec’ in this file :
/usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb to
send custom ip , hostname to Vmware clone ( from template ) .

With static details like :

customization_spec' => {

'domain' => "mobimate.local",

'hostname' => args[:name].split('.',2)[0],

'ipsettings' => {

'ip' => “xxx.xxx.xxx.xxx",

'gateway' => [“xxx.xxx.xxx.xxx"],

'subnetMask' => “xxx.xxx.xxx.xxx”,

Everything is working fine.

I would like to know where is the View that we can get the IP that foreman
automatically generated

I need to passed the ip to the ip variable in the customization_spec.

Thanks ,

Amit Daniel

guys please help me with that
i need your help

Thanks

בתאריך יום שני, 19 בינואר 2015 בשעה 16:14:34 UTC+2, מאת עמית דניאל:

··· > > Hello , > > > I've been added ‘customization_spec’ in this file : > /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb to > send custom ip , hostname to Vmware clone ( from template ) . > > > With static details like : > > > customization_spec' => { > > 'domain' => "mobimate.local", > > 'hostname' => args[:name].split('.',2)[0], > > 'ipsettings' => { > > 'ip' => “xxx.xxx.xxx.xxx", > > 'gateway' => [“xxx.xxx.xxx.xxx"], > > 'subnetMask' => “xxx.xxx.xxx.xxx”, > > > Everything is working fine. > > > I would like to know where is the View that we can get the IP that foreman > automatically generated > > I need to passed the ip to the ip variable in the customization_spec. > > > Thanks , > > Amit Daniel > >

Within the VMware compute resource, you generally don't have access to
the host to retrieve the IP address set. Have a look at the method
stack trace - you're going from setCompute in
app/models/concerns/orchestration/compute.rb, to create_vm in vmware.rb,
to clone_vm.

You could perhaps add the IP address into the compute_attributes hash
that's merged in setCompute, e.g. :ip => ip ("ip" is valid here as
you're inside the host object), then access it as args[:ip] later.

··· On 19/01/15 14:14, עמית דניאל wrote: > Hello , > > > I've been added ‘customization_spec’ in this file : > /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb > to send custom ip , hostname to Vmware clone ( from template ) . > > > With static details like : > > > customization_spec' => { > > 'domain' => "mobimate.local", > > 'hostname' => args[:name].split('.',2)[0], > > 'ipsettings' => { > > 'ip' => “xxx.xxx.xxx.xxx", > > 'gateway' => [“xxx.xxx.xxx.xxx"], > > 'subnetMask' => “xxx.xxx.xxx.xxx”, > > > Everything is working fine. > > > I would like to know where is the View that we can get the > IP that foreman automatically generated > > I need to passed the ip to the ip variable in the > customization_spec.


Dominic Cleal
Red Hat Engineering

you might have a look at this pr, which tries to not only handle ip but all
parameters and pass them as customisation spec to the vcenter cr
https://github.com/theforeman/foreman/pull/2000

··· El 22/01/2015 09:52, "Dominic Cleal" escribió:

On 19/01/15 14:14, עמית דניאל wrote:

        Hello ,


        I've been added ‘customization_spec’ in this file :

/usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb

        to send custom ip , hostname to Vmware clone ( from template

) .

        With static details like :


        customization_spec' => {

        'domain' => "mobimate.local",

        'hostname' => args[:name].split('.',2)[0],

        'ipsettings' => {

        'ip' => “xxx.xxx.xxx.xxx",

        'gateway' => [“xxx.xxx.xxx.xxx"],

        'subnetMask' => “xxx.xxx.xxx.xxx”,


        Everything is working fine.


        I would like to know where is the View that we can get the
        IP that foreman automatically generated

        I need to passed the ip to the ip variable in the
        customization_spec.

Within the VMware compute resource, you generally don’t have access to
the host to retrieve the IP address set. Have a look at the method
stack trace - you’re going from setCompute in
app/models/concerns/orchestration/compute.rb, to create_vm in vmware.rb,
to clone_vm.

You could perhaps add the IP address into the compute_attributes hash
that’s merged in setCompute, e.g. :ip => ip (“ip” is valid here as
you’re inside the host object), then access it as args[:ip] later.


Dominic Cleal
Red Hat Engineering


You received this message because you are subscribed to the Google Groups
“foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.