Hi,
First thank you for the response , For my situation i m trying to
develop a plugin for foreman .. and i need to create a list of hosts
automatically From my platform to Foreman ..The bridge is my plugin so
instead of using a rest Api of foreman and creating host by host with
making the parameters manually .. i want to call just a method from
foreman that create a host and then look to automatize the operation .
I did in my plugin controller .
Host.create :name=> test , :manage=> false , :build=> false
Hostgroup.create :name=> testgroup
So i want to know how can add parameters to the host and hostgroup
creation
I tried to do
Host.create :name=> test , :manage=> false , :build=> false ,
operatingsystem_id => 1
but it doesn't work ??
Thanks again for your help
Le mercredi 2 août 2017 08:09:39 UTC+2, oprazak a écrit :
>
> Hi,
> I am not sure what you are trying to do and where you call your method,
> but it may be a strong parameter issue. We create host(group) by passing it
> parameters and calling 'save' on it [1].
> Notice the 'hostgroup_params' method. It comes from a concern [2] that
> takes care of whitelisting the params that we want to update. So if you add
> new fields, you need to make sure they do not get filtered out.
>
> Hope this helps,
> Ondrej Prazak
>
> [1]
> https://github.com/theforeman/foreman/blob/develop/app/controllers/hostgroups_controller.rb#L42-L43
> [2]
> https://github.com/theforeman/foreman/blob/develop/app/controllers/concerns/foreman/controller/parameters/hostgroup.rb
>
> On Tue, Aug 1, 2017 at 10:06 AM, Fairouz el ouazi <[email protected]
> <javascript:>> wrote:
>
>> Hi everyone !!
>>
>> My questions will sound a bit stupide but i don't know how to call the
>> method create Host or hostgroup with new fields from my new plugin ? all i
>> know is with name and when i add fields value like operating_system id it
>> doesn't' appears on foreman UI ?
>>
>> Thanks in advance for you help
>>
>> --
>> 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 [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.