Hi,
Having installed Puppet 2.7.1 on my testserver yesterday, I am now bugged
by log messages, that tell me not to use dynamic variable lookups:
Jun 29 13:31:09 os1 puppet-master[31910]: Dynamic lookup of
$ssh_permitrootlogin at /etc/puppet/templates/etc/ssh/sshd_config.erb:28
is deprecated. Support will be removed in Puppet 2.8. Use a
fully-qualified variable name (e.g., $classname::variable) or
parameterized classes.
Now, I have been reading up on variable scoping and trying to figure out
how to rewrite my manifests to embrace best practices, but I am confused
on how to proceed, and I can't really find any working examples, so I turn
here for help.
My current setup is something like this:
node basenode {
$somevar = "defaultvalue"
$someothervar = "anotherdefault"
}
node internal inherits basenode {
$someothervar = "internaloverride"
}
node external inherits basenode {
}
node myinternalserver inherits internal {
$somevar = "nodeoverride"
include generic
}
node someexternalserver inherits external {
include generic
}
...another 40 node definitions, inheriting either internal or external...
class generic {
include someclass
include somemodule::anotherclass
...
include <a whole bunch of other classes that every node needs>
}
In any class or module I use $somevar and $someothervar as I please, and I
understand that this a) is not a recommended practice and b) will stop
working in Puppet 2.8.
So, what should I do?
Switching to parameterized classes sounds nice, but that would mean that
the 'generic' class would have to get /every/ variable I use as a
parameter and pass it on to subsequent classes where needed. That sounds
incredibly clumsy to me.
In http://docs.puppetlabs.com/guides/scope_and_puppet.html I read:
"If you’re using dynamic scope to share resource defaults, there’s no
way around it: you’ll have to repeat yourself in each file that the
defaults apply to."
Is this what's biting me here? Well, this sounds like something I can live
with, after all: it's not the default values I care about, it's the
overriding values.
Further, it states:
"If you need to apply resource defaults more broadly, you can still set
them at top scope in your primary site manifest. If you need the resource
defaults in a class to change depending on where the class is being
declared, you need parameterized classes."
And we're back at parameterized classes. And what does 'top scope' mean
exactly? I assume that would be in 'site.pp', outside any class or node
definition?
To make a long question short: what is the recommended way to override
values for certain nodes or groups of nodes (by inheritance)? And I'd
/really/ prefer to do that without having to pass on each and every value
as a parameter to the next included class...
Best regards,
Martijn.
--
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.