Hi everyone, Let''s say that I have declared a virtual ressource as follow: @group { ''test'': gid => ''999'', tag => [ ''test'' ], } Is that possible to do some kind of "+>" later on? like that Group[''test''] { tag +> [''foo''] } Because when I want to create the virtual ressource I have no idea what all the tags will be. Regards, JM -- 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 Jan 11, 11:59 am, Antidot SAS <antidot...@gmail.com> wrote:> Hi everyone, > > Let''s say that I have declared a virtual ressource as follow: > @group { ''test'': > gid => ''999'', > tag => [ ''test'' ], > > } > > Is that possible to do some kind of "+>" later on? > like that > > Group[''test''] { tag +> [''foo''] } > > Because when I want to create the virtual ressource I have no idea what all > the tags will be.I''m not sure I understand. Do you mean that even when you want to *realize* the resource you don''t know what the tags will be, or is it just when you *define* the resource that you don''t know? And related: what is your intended use for the tags you want to add to these resources? In any case, why don''t you know what the tags should be? You can override resource properties in a subclass of the class that defines the resource, and / or you can override resource properties when you collect a virtual / exported resource (the latter comes with some caveats). The plusignment operator works in both contexts, I believe. If that doesn''t meet your needs then we may be able to suggest an alternative approach, given a better understanding of the problem. 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.
On Wed, Jan 11, 2012 at 11:59 AM, Antidot SAS <antidotsas@gmail.com> wrote:> Hi everyone, > > > Let''s say that I have declared a virtual resource as follow: > @group { ''test'': > gid => ''999'', > tag => [ ''test'' ], > } > > > Is that possible to do some kind of "+>" later on? > like that > > Group[''test''] { tag +> [''foo''] }I think the syntax is along the line of: Group <| title == ''test'' |> { tag +> [''foo''], } Not sure off the top of my head if this can be done multiple times, in any case once is probably the best idea. Thanks, 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.
On Jan 12, 10:44 am, Nan Liu <n...@puppetlabs.com> wrote:> Not sure off the top of my head if this can be done multiple times, in > any case once is probably the best idea.For any given resource, it can only be done once. In fact, doing it even once means the resource cannot be realized or collected anywhere else, even without a resource override. I understand why that is -- in fact, I agree with doing it that way -- but it still constitutes a major drawback to this approach. In short, I guess, I recommend avoiding overriding properties at collection time even once, if at all possible. 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.