Re: [foreman-dev] CREATE host or hostgroup with new fields

2017-08-08 Thread Fairouz el ouazi


Le jeudi 3 août 2017 13:03:22 UTC+2, Greg Sutcliffe a écrit :
>
> On Wed, 2017-08-02 at 05:15 -0700, Fairouz el ouazi wrote: 
> > Hi Greg , 
> >I did sent you a message i don't know if you get it ? 
>
> You sent it to me personally instead of to the mailing list, and it got 
> filtered to a folder I don't often look at. Make sure you're replying 
> to the list rather than privately :) 
>
> You say you've not published the code - that makes it very difficult to 
> help you. It's almost impossible to say what the issue might be without 
> it - there are just too many unknowns. 
>  I m really a beginner in ruby and i know it's embarrassing to publish 
> a code 

with many faults .  
My problem is that i don't know how create a host with many global 
Parameters
I can do it with one paramater . 
   Host.create :name=> test , :manage=> false , :build=> false  , 
:host_parameters_attributes => [:name => 'dfdfd' , :value => 'hj'h' ]
Now if i want to make more host_parameters_attributes  i don't know the 
syntax ?

Thanks again , 

>
> Unless you have specific business reasons not to publish it, then I 
> would suggest grabbing a Git repo on GitHub or Gitlab, storing the code 
> then, and then replying with a link to where you're seeing issues in 
> your code. You've really nothing to lose, and everything to gain. 
>
> Cheers 
> Greg 
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [foreman-dev] CREATE host or hostgroup with new fields

2017-08-03 Thread Greg Sutcliffe
On Wed, 2017-08-02 at 05:15 -0700, Fairouz el ouazi wrote:
> Hi Greg , 
>I did sent you a message i don't know if you get it ? 

You sent it to me personally instead of to the mailing list, and it got
filtered to a folder I don't often look at. Make sure you're replying
to the list rather than privately :)

You say you've not published the code - that makes it very difficult to
help you. It's almost impossible to say what the issue might be without
it - there are just too many unknowns.

Unless you have specific business reasons not to publish it, then I
would suggest grabbing a Git repo on GitHub or Gitlab, storing the code
then, and then replying with a link to where you're seeing issues in
your code. You've really nothing to lose, and everything to gain.

Cheers
Greg

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [foreman-dev] CREATE host or hostgroup with new fields

2017-08-02 Thread Fairouz el ouazi
Hi Greg , 
   I did sent you a message i don't know if you get it ? 

Le mercredi 2 août 2017 11:15:39 UTC+2, Greg Sutcliffe a écrit :
>
> It's also worth noting that trying to assist with code problems is 
> almost impossible when we can't see the code. Do you have you plugin 
> available on the public internet somewhere (e.g. GitHub) for us to look 
> at? 
>
> Greg 
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [foreman-dev] CREATE host or hostgroup with new fields

2017-08-02 Thread Greg Sutcliffe
It's also worth noting that trying to assist with code problems is
almost impossible when we can't see the code. Do you have you plugin
available on the public internet somewhere (e.g. GitHub) for us to look
at?

Greg

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [foreman-dev] CREATE host or hostgroup with new fields

2017-08-02 Thread Fairouz el ouazi
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  > 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 foreman-dev...@googlegroups.com .
>> 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 foreman-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [foreman-dev] CREATE host or hostgroup with new fields

2017-08-01 Thread Ondrej Prazak
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 
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 foreman-dev+unsubscr...@googlegroups.com.
> 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 foreman-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[foreman-dev] CREATE host or hostgroup with new fields

2017-08-01 Thread Fairouz el ouazi
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 foreman-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.