Spenser Gilliland <spenser...@gmail.com> wrote:

> Yeap, I'm seeing that it doesn't exist yet either.  I'm thinking maybe
> I can use exported resources or maybe just an exec that increments a
> counter on the host.  Either way it's not very pretty.  My use case is
> as follows:
> 
> In Debian, Redmine has the option of being installed as several
> instances controlled by a single debconf variable.  In order to
> utilize this feature, I need to supply debconf with the name of all
> instances of Redmine on the server. I've split this out into the
> following way:  A class called Redmine which installs the Redmine
> package and should hold an array of all the instances of Redmine to
> feed to debconf using the "responsefile" parameter.
> 
> So I think I've come up with a solution in my head but it involves me
> guaranteeing that the redmine class is instantiated before any of the
> redmine::instances are defined.  Essentially, I'll use an
> environmental variable or file and clear it with the Redmine class and
> append to it for each redmine::instance.  Maybe like below?
> 
> class redmine {
>     exec{"rm /tmp/instances && touch /tmp/instances"}
> }
> 
> define redmine::instance
>    exec{"echo $name >> /tmp/instances"}
> }
> 
> I guess the next question is can i guarantee that my class will be
> instantiated prior to my instances and there is no possibility of the
> class being re-instantiated during the course of the puppet run?

The approach you're suggesting seems very ugly :-)

I'd suggest trying one of two different approaches :
 * Create a definition to which you'll pass an array of all instances,
   which will then call the redminde::instance for each. This only
   works of course if you're not trying to add new instances from
   various puppet classes/definitions.
 * Create a fact which returns all of the redmine instances of the
   puppet client. This has quite a few limitations, but might work
   depending on what you need exactly.

HTH,
Matthias

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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