Issue #16438 has been reported by Peter Meier.
----------------------------------------
Bug #16438: run stage of a define is not passed to an included class
https://projects.puppetlabs.com/issues/16438
Author: Peter Meier
Status: Unreviewed
Priority: Normal
Assignee:
Category: stages
Target version:
Affected Puppet version: 2.7.19
Keywords:
Branch:
I tried the following:
<pre>
$ cat foo.pp
class required {
notify{'required': }
}
define something{
require required
notify{"something_${name}": }
}
class manage_something{
something{'blub': }
}
class before_main {
include manage_something
}
class mainconfig {
stage{'before': before => Stage['main'] }
class{'before_main': stage => 'before' }
}
node default {
include mainconfig
}
$ puppet apply foo.pp
err: Could not apply complete catalog: Found 1 dependency cycle:
(Notify[required] => Class[Required] => Something[blub] =>
Notify[something_blub] => Something[blub] => Class[Manage_something] =>
Stage[before] => Stage[main] => Class[Required] => Notify[required])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle
or GraphViz
notice: Finished catalog run in 0.02 seconds
</pre>
Changing the require statement to an include makes it clear that the included
class ends up in the main stage:
<pre>
$ cat foo.pp
class required {
notify{'required': }
}
define something{
# require required
include required
notify{"something_${name}": }
}
class manage_something{
something{'blub': }
}
class before_main {
include manage_something
}
class mainconfig {
stage{'before': before => Stage['main'] }
class{'before_main': stage => 'before' }
}
node default {
include mainconfig
}
$ puppet apply foo.pp
notice: something_blub
notice:
/Stage[before]/Manage_something/Something[blub]/Notify[something_blub]/message:
defined 'message' as 'something_blub'
notice: required
notice: /Stage[main]/Required/Notify[required]/message: defined 'message' as
'required'
notice: Finished catalog run in 0.05 seconds
</pre>
While nesting it with a require outside the define makes it work properly:
<pre>
$ cat foo.pp
class required {
notify{'required': }
}
define something{
notify{"something_${name}": }
}
class manage_something{
require required
something{'blub': }
}
class before_main {
include manage_something
}
class mainconfig {
stage{'before': before => Stage['main'] }
class{'before_main': stage => 'before' }
}
node default {
include mainconfig
}
$ puppet apply foo.pp
notice: required
notice: /Stage[before]/Required/Notify[required]/message: defined 'message' as
'required'
notice: something_blub
notice:
/Stage[before]/Manage_something/Something[blub]/Notify[something_blub]/message:
defined 'message' as 'something_blub'
notice: Finished catalog run in 0.05 seconds
</pre>
Having the require in the define should work, because that is quite a common
pattern to setup tools in a class that are then used within the define!
Might be related to #5673
--
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 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-bugs?hl=en.