On Tue, Feb 7, 2012 at 1:13 PM, jimbob palmer <[email protected]> wrote:
> 2012/2/7 Jan Ivar Beddari <[email protected]>:
>> On 02/07/2012 03:54 PM, jimbob palmer wrote:
>>>>
>>>>
>>>> # The right way
>>>> class foo::specific {
>>>> include 'foo::common'
>>>> # specific stuff
>>>> }
>>>
>>>
>>> So can I be sure that the include will run first, before the "specific
>>> stuff" here?
Yes, you just have to be explicit and specify relationship.
> Yikes so how can I be sure that the included stuff gets included
> before I need it? Say it pulls in some variables and package
> requirements.
The variables are evaluated during compilation so include the class
before you reference any variables. If you need resource in
foo::package applied before foo::specific:
require 'foo::package'
or 2.7 parametrized class:
class { 'foo::package':
version => 'latest',
}
Class['foo::package'] -> Class['foo::specific']
> And a related question: if I have a case statement at the top of my
> class that sets a variable, how can I be sure the variable will be set
> before I need it lower down in the same class?
If you mean there's a variable in foo::common you want to reference in
foo::specific just use fully qualified variable and include
foo::common.
include foo::common
if $::foo::common:variable {
...
}
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.