Hi! Anyone knoe if it''s possible to realize resources with the spaceship operator checking for regex equality? Something like: User<| group =~ /(qa|prod)/ |> If not, anyone know of another way to do this sort of thing? Thanks a lot! Guy -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mon, Mar 19, 2012 at 2:58 PM, Guy Matz <gmatz@matz.org> wrote:> Hi! Anyone knoe if it''s possible to realize resources with the spaceship > operator checking for regex equality? > > Something like: > > User<| group =~ /(qa|prod)/ |> > > If not, anyone know of another way to do this sort of thing?No regex support, but I think you can do User <| (group == ''qa'' or group == ''prod'') |>. HTH, Nan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
OK... this is similar to something that I''ve been scratching my head over... Given something like @@file { "blah: ${hostname}": .... } and @@file {"foo: ${hostname}": ...} I''m going to have a bunch of exported resources On one system I want to instantiate all the "blah:" and on another "foo:" what mechanism can I use to make that happen? if I just do File <| |> I''ll get everything and if I do File<| tag ="blah" |> I''ll miss everything... or am I missing something? On Mon, Mar 19, 2012 at 5:00 PM, Nan Liu <nan@puppetlabs.com> wrote:> On Mon, Mar 19, 2012 at 2:58 PM, Guy Matz <gmatz@matz.org> wrote: > > Hi! Anyone knoe if it''s possible to realize resources with the spaceship > > operator checking for regex equality? > > > > Something like: > > > > User<| group =~ /(qa|prod)/ |> > > > > If not, anyone know of another way to do this sort of thing? > > No regex support, but I think you can do User <| (group == ''qa'' or > group == ''prod'') |>. > > HTH, > > Nan > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- Peter L. Berghold Owner, Shark River Technical Solutions LLC -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mar 20, 8:29 am, Peter Berghold <salty.cowd...@gmail.com> wrote:> OK... this is similar to something that I''ve been scratching my head over... > > Given something like > > @@file { "blah: ${hostname}": .... } > > and > > @@file {"foo: ${hostname}": ...} > > I''m going to have a bunch of exported resources > > On one system I want to instantiate all the "blah:" and on another "foo:" > > what mechanism can I use to make that happen? > > if I just do File <| |> I''ll get everything and if I do File<| tag => "blah" |> I''ll miss everything... or am I missing something?Maybe you are missing that you can set explicit tags in your resource declarations, like so: @@file { "blah: ${hostname}": tag = ''blah'', ... } by which you could make File<<| tag == ''blah'' |>> do what you want. Perhaps you are missing that resources automatically get tagged with the names of the classes that declare them, and the names of the classes that declare those, etc.. Depending on where your exported resources are declared, you might be able to use that to power File<<| tag == ''mymodule::myclass'' |>>. It could be that you are missing that defined type instances can be exported just like any other resource, so that you could also do define blah () { file { "/etc/blah/${name}": ... } } @@blah { "${hostname}": } ... Blah<<| |>> None of that is intended to say that regex matching in the collection predicate wouldn''t be useful, but there are plenty of ways to be selective about what resources get collected. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.