Appending and overriding attributes can only be done in subclasses,
not in the same scope that the attribute is set.
I'm not actually convinced this makes a ton of sense in the current
parser, now that I think of it, though...
--
Don't hit at all if it is honorably possible to avoid hitting; but
never hit soft! -- Theodore Roosevelt
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
FWIW, the following does not appear to work (inside a module called
mail, it's manifests/init.pp):
class mail {
mailalias { "root":
ensure => absent,
notify => Exec["newaliases"]
}
exec { "newaliases":
command => "newaliases",
refreshonly => true
}
class aliases inherits mail {
define root ( $enable = true, $recipient = [ ] ) {
Mailalias["root"] {
enable => $enable ? {
false => absent,
default => present
},
recipient +> $recipient
}
}
}
}
(Note how by default it sets the root mailalias to absent, which is
equivalent to the default "#root: marc" line in /etc/aliases)
I deliberately used a subclass "mail::aliases" because changing a
parameter to a type within the same scope doesn't work; I wanted to use
something like the following to set the root mail alias:
node 'node1.domain.tld' {
include mail::aliases
mail::aliases::root { "$fqdn":
enable => true,
recipient => [ "kan...@kanarip.com" ]
}
}
But it does not appear to work either; the error message is something
like "Only subclasses can override ...".
Dunno whether this is expected behavour though?
Kind regards,
Jeroen van Meeuwen
-kanarip