Issue #2105 has been updated by Samuli Seppänen.
Affected Puppet version changed from 0.24.8 to 3.3.0
The current tagging implementation is highly annoying if one is using this kind
of module pattern:
<pre>
class myclass {
include myclass::install
include myclass::config
include myclass::service
if tagged('monit') {
include myclass::monit
}
if tagged('packetfilter') {
include myclass::packetfilter
}
}
</pre>
The idea is to only include (local) monitoring configuration if class "monit"
is included. Similarly, packet filtering rules are only included if the
"packetfilter" class is included. While this pattern works, one has to very
carefully place where one includes the "monit" and "packetfilter" classes or
the node's configuration might be incomplete:
* If using classic node definitions, "monit" and "packetfilter" have to be
included at the root of the node inheritance hierarchy (e.g. default.pp).
* If using Hiera the exact opposite is true. This makes more sense, as whether
to use "monit" or "packetfilter" on a given node is a per-node policy decision.
The "monit" and "packetfilter" classes also have to included as high as
possible in the .pp/.yaml/.json files or one could again end up with a
partially configured node.
It'd be great if the list of tags would be generated before the actual Puppet
run. At the very least this order dependence should be documented. The
alternative would be to resort to using "magic variables" in the node
definitions or in Hiera, which is also suboptimal.
----------------------------------------
Bug #2105: Order matters with tagged function
https://projects.puppetlabs.com/issues/2105#change-97532
* Author: Lawrence Ludwig
* Status: Needs Decision
* Priority: Normal
* Assignee: Nick Fagerlund
* Category: documentation
* Target version:
* Affected Puppet version: 3.3.0
* Keywords:
* Branch:
----------------------------------------
It should be noted in the documentation of the limits when using the 'tagged'
function ordering of classes via 'include' matters. Ie this code.
code:
<pre>
class a {
notify {"class a": }
if tagged("b") {
notify {"found class b": }
}
}
class b {
notify {"class b": }
}
class test {
notify {"class test": }
include a
include b
}
</pre>
test output:
<pre>
[root@bast ~]# puppet -e "include test" test.pp --verbose --logdest=console
--debug
debug: importing '/home/larry/test.pp'
info: Autoloaded module test
debug: Creating default schedules
debug: //test/a/Notify[class a]: Changing message
debug: //test/a/Notify[class a]: 1 change(s)
notice: class a
notice: //test/a/Notify[class a]/message: defined 'message' as 'class a'
debug: //test/Notify[class test]: Changing message
debug: //test/Notify[class test]: 1 change(s)
notice: class test
notice: //test/Notify[class test]/message: defined 'message' as 'class test'
debug: //test/b/Notify[class b]: Changing message
debug: //test/b/Notify[class b]: 1 change(s)
notice: class b
notice: //test/b/Notify[class b]/message: defined 'message' as 'class b'
debug: Finishing transaction 70131190151540 with 3 changes
</pre>
will only output "found class b" when the order of includes is reversed.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.