I've run into the following issue with parameters that are dependent on
each other. Suppose I have the following class:
class foo(
$owner,
$prefix = "/opt/${owner}",
$etc_dir = "${prefix}/etc"
) {
file{"${etc_dir}":
ensure => directory,
owner => $owner,
group => $owner,
mode => 0660,
...
}
The order that the parameters are defined appears to be non-deterministic,
so that sometimes $etc_dir is defined before $prefix. Which means that $etc
is set to '/etc', and of course, this restricts the permissions on /etc,
which breaks the server (including preventing any user, including root,
from sudoing!). Fortunately, this was found while testing manifests on
disposable virtual machines. I shudder to think what would have happened if
we didn't figure out the cause and deployed this on actual servers.
So, am I correct in assuming that the order of parameter setting is
non-deterministic (and so should avoid setting them like above), or is
there something else going on?
If parameter order is not deterministic, I do think it should be explicitly
documented, with a warning about what can go wrong. (Apologies if I've been
daft and missed an existing mention of this somewhere.)
FWIW, I added a note to http://projects.puppetlabs.com/issues/4408 about
this issue.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/AjNp3Hlh8woJ.
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.