Issue #2931 has been updated by Luke Kanies.
Category set to language
Status changed from Needs more information to Accepted
Target version set to Puppet - Rowlf
But that's a pretty big behaviour change, in that it's perfectly reasonable for
different subclasses to set defaults for the same param.
And this isn't multiple inheritance - a given class can only have one parent.
I think the right solution is to add an 'extends' keyword that causes the class
sets to use the same scope:
<pre>
class one {
File{mode=>777}
file{
'/tmp/one':
content => 'one';
'/tmp/two':
content => 'two';
}
}
class two extends one{
File{mode => 664}
}
#include one
include two
</pre>
In this case, they would share a scope, and we'd follow standard override
rules, meaning that a default set by a subclass would work but not by a peer.
This would give the error as above when peer subclasses tried the same override.
Really, this is probably 99% of the subclass behaviour people actually want.
This shouldn't even be that hard, given the newly extracted resource types from
the language.
The hardest part, really, is figuring out and documenting the edge cases, esp.
given that we don't yet have futures or lazy evaluation. I.e., the following
still won't quite behave the way people want:
<pre>
class one {
$content = "something"
file { "/foo": content => $content }
}
class two extends one {
$content = "something else"
}
</pre>
With futures, though, this all works great.
----------------------------------------
Bug #2931: resource defaults should work with inheritence
http://projects.reductivelabs.com/issues/2931
Author: Dan Bode
Status: Accepted
Priority: Normal
Assigned to:
Category: language
Target version: Rowlf
Affected version: 0.25.1
Keywords:
Branch:
It should be possible to use inheritance to change default resource values.
Class two should override the default resource param mode to 664.
<pre>
class one {
File{mode=>777}
file{
'/tmp/one':
content => 'one';
'/tmp/two':
content => 'two';
}
}
class two inherits one{
File{mode => 664}
}
#include one
include two
</pre>
--
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://reductivelabs.com/redmine/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.