i'm trying to pass Resources (single or in an array) to a resource, so I can pass this to a notify or require. However I have some problems, when no resource should be passed. Maybe somebody can help me? thanks
I'm no expert, but why don't you try wrapping the require => $require statments with an 'if $require', just to make sure it only tries to set it if the variable exists. That way if you don't pass a $require, it won't exist and should work!
On Sat, Mar 22, 2008 at 3:03 PM, Peter Meier <peter.me...@immerda.ch> wrote:
> Hi
> i'm trying to pass Resources (single or in an array) to a resource, so I > can pass this to a notify or require. However I have some problems, when > no resource should be passed. Maybe somebody can help me? thanks
> i'm trying to pass Resources (single or in an array) to a resource, > so I > can pass this to a notify or require. However I have some problems, > when > no resource should be passed. Maybe somebody can help me? thanks
You don't need to declare these (in fact, you should be seeing a warning for them); all defined types automatically support all metaparameters.
Otherwise, follow the advice of the other poster: default to false, and test for the value before you go ahead and set it on the resource. That won't work for metaparameters, because resources automatically acquire all metaparameters from the definition they're in.
-- A bore is a man who deprives you of solitude without providing you with company. -- Gian Vincenzo Gravina --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
> Otherwise, follow the advice of the other poster: default to false, > and test for the value before you go ahead and set it on the > resource. That won't work for metaparameters, because resources > automatically acquire all metaparameters from the definition they're in.
| Hi | |> You don't need to declare these (in fact, you should be seeing a |> warning for them); all defined types automatically support all |> metaparameters. | | ah cool. Didn't know that. I tried to add this to the Language Tutorial: | http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial?action=dif... | I hope that this might be ok?! Otherwise please change/correct it. |
Might want to include an example and a bit more information - the Tutorial is designed as an introduction.
On Sat, 2008-03-22 at 15:35 -0500, Luke Kanies wrote: > On Mar 22, 2008, at 2:03 PM, Peter Meier wrote:
> > Hi
> > i'm trying to pass Resources (single or in an array) to a resource, > > so I > > can pass this to a notify or require. However I have some problems, > > when > > no resource should be passed. Maybe somebody can help me? thanks
> It was my understanding that they fully propagate, but I just want > to be > sure it's really the case.
This really is very easy to test:
define mptest { notify { "this is a $name test": }
}
mptest { yay: loglevel => warning }
Prints:
warning: this is a yay test
Notice the loglevel.
-- This book fills a much-needed gap. -- Moses Hadas --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com