On Thursday, November 8, 2012 6:29:47 PM UTC-6, erkules wrote:
>
> Hi, Im still confused: 
>
> On Fri, Oct 26, 2012 at 12:24:52PM -0700, jcbollinger wrote: 
> > 
> > 
> > On Friday, October 26, 2012 11:32:36 AM UTC-5, erkules wrote: 
> > > 
> > 
> > > If not is there a trick to call a class many times for a node. (Maybe 
> by 
> > > manipulating the name?) 
> > > 
> > > 
> > You can create classes with different names but similar content, or you 
> can 
> > use one class that wraps all the resources you want.  For example, 
> > 
> > class mymodule::lxc_application_containers { 
> >   mymodule::lxc_application_container { 'container1: 
> >     application => 'Awesomeness1.1' 
> >     # other parameters 
> >   } 
> >   mymodule::lxc_application_container { 'container2: 
> >     application => 'Moneymaker3.2' 
> >     # other parameters 
> >   } 
> >   # other containers ... 
> > } 
> > 
> > Supposing that the point is to select a subset of the available 
> > applications for each target node, using the one-class approach, you can 
> do 
> > that via global variables (yuck), class parameters (meh), or data from 
> an 
> > external source (best bet). 
>
> So you got a fixed number in here where you filter the right ones? 
>


Ideally, you know what the right ones are and your class declares only 
those.  You can, however, use one or another sort of conditional to choose 
which of the possible ones to declare.

 

> I would like to call the class with parameters  and for each parameter 
> the defined type is called. Where a parameter is a hash with 3 keys (where 
> one is the name). 
>


That sounds a lot like the behavior of the built-in create_resources() 
function.  Look it up in the Puppet function reference.

 

> With this I could decide to run more or less containers just by adding 
> parameters. 
>


Puppet classes and definitions do not have varargs support.  All the 
parameters they can accept must be pre-defined, though you can assign 
default values to them so that you don't need to declare each one each 
time.  Puppet does support arrays and hashes, however, and these can be 
assigned as parameter values.
 

>
> I don't know if this is a possible way to implement my needs *kopfkraz* 
>
>
It would help if you were clearer about what your actual needs *are*.  I 
have given you rather a lot of information about how you can approach your 
task with Puppet, but you remain unsatisfied.  If I have not been speaking 
to your issue then it is because I don't know what your issue is.



John





-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/8omI8AxRD7wJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to