Bug #8702
"including" 2 inherited classes via class resource syntax is order dependant
| Status: | Duplicate | Start date: | 07/29/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% | |
| Category: | parameterized classes | |||
| Target version: | - | |||
| Affected Puppet version: | Branch: | |||
| Keywords: | ||||
Description
While encountering #5349 and trying to find a workaround for it, I came up with another weirdness of parametrized classes:
# cat foo.pp
stage { "pre": before => Stage[main] }
class a {
file{'/tmp/a': ensure => present }
}
class b inherits a {
file{'/tmp/b': ensure => present, require => File['/tmp/a'] }
include c
}
class c {
file{'/tmp/c': ensure => present }
}
class {['b','a']: stage => pre }
# puppet foo.pp
Duplicate definition: Class[A] is already defined; cannot redefine at /root/foo.pp:15 on node foo
But the following works:
# cat foo.pp
stage { "pre": before => Stage[main] }
class a {
file{'/tmp/a': ensure => present }
}
class b inherits a {
file{'/tmp/b': ensure => present, require => File['/tmp/a'] }
include c
}
class c {
file{'/tmp/c': ensure => present }
}
class {['a','b']: stage => pre }
# puppet foo.pp
notice: Finished catalog run in 0.56 seconds
Imho both cases should work.
Related issues
History
#1
Updated by James Turnbull almost 2 years ago
- Status changed from Unreviewed to Needs Decision
- Assignee set to Nigel Kersten
#2
Updated by Nigel Kersten almost 2 years ago
- Status changed from Needs Decision to Accepted
- Assignee deleted (
Nigel Kersten)
#3
Updated by Nick Fagerlund 10 months ago
- Status changed from Accepted to Duplicate
This is good ol' bug #5046 rearing its fugly head again. The “inherits” keyword actually DECLARES the base class with a mechanism similar to “include,” which causes any subsequent resource-like declaration of the base class to explode.
I’ve added that extra “inherits” wrinkle to #5046’s description. Closing this as dupe.