On Sat, Dec 18, 2010 at 6:09 PM, Daniel Pittman <dan...@rimspace.net> wrote:
> On Sun, Dec 19, 2010 at 08:24, Spenser Gilliland <spenser...@gmail.com> wrote:
>
>> I've come into a use case where I need a list of all the instances of
>> a definition.  I'd like the syntax to be
>
> [...]
>
>> I'm not sure if this will work as anticipated.  I believe that this
>> will only update $instance in the test::instance scope not the test
>> scope.
>
> That would be about the shape of it.
>
> [...]
>
>> Can anyone help me figure this out?  It seems like this would be a
>> fairly common thing to do.
>
> I strongly suspect it is actually kind of "not the puppet way", at
> least at the moment.  Can you tell us what the problem you are trying
> to solve is?  That would make it easier to help identify the more
> canonical puppet way of doing whatever it is.
>
> My guess is that there isn't a nice way of doing it and that answer is
> going to be the "concat" module to build a file from little fragments,
> or use the Ruby DSL, or something: I guess you need to reference all
> those items in some other configuration file, and it doesn't provide a
> "include this glob" operation, right?
>
> Regards,
>    Daniel
> --
> ✣ Daniel Pittman            ✉ dan...@rimspace.net            ☎ +61 401 155 707
>               ♽ made with 100 percent post-consumer electrons
>
> --
> 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.
>
>

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?

Thanks,
Spenser

-- 
Spenser Gilliland
Computer Engineer
Illinois Institute of Technology

-- 
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