Issue #22587 has been updated by Vadim Nevorotin.
Ok, problem is not exactly in default values. I've tested some manifests and
have found, that problem is in passing 'undef' value into class or defined
type. E.g.
define bar (
$param = 'defined',
) {
notify {"bar-$title: $param": }
}
bar {'test1': }
bar {'test2':
param => undef,
}
Second message will be 'defined', but should be 'undef'. This is the problem,
then you wrap some standard resources in class or defined type with not undef
default values. E.g.:
class foo (
$ensure = 'running',
) {
service { 'foo':
ensure => $ensure,
}
}
class {'foo':
ensure => undef,
}
This willn't work, moreover, there is no valid value for ensure property of
class that can leave service in current state. In simple classes you can use
some workarounds, but if you have a lot of modules it can be a big problem.
The simplest way to fix it - add default, defined value to all attributes. Not
undef. And recommends never use undef as default value for attributes.
Or pass 'undef' as regular value to all resources and add some code to
recognize it.
----------------------------------------
Feature #22587: Default value for all type's atrributes
https://projects.puppetlabs.com/issues/22587#change-98813
* Author: Vadim Nevorotin
* Status: Needs More Information
* Priority: Normal
* Assignee: Vadim Nevorotin
* Category:
* Target version:
* Affected Puppet version:
* Keywords:
* Branch:
----------------------------------------
Each attribute for all built-in types must have default values. (from here:
http://docs.puppetlabs.com/references/3.stable/type.html)
It's very important when you wrap some type with parametrized class/defined
type. I that case you should pass parameters from container to wrapped type. So
you must know default values for all type's attribute to add then as default
values for class/defined type.
E.g. you has standard package->config->service parametrized class. You want to
add enable and ensure attributes of service to main class:
class someclass (
$ensure = ????,
$enabled = ????,
...
) {
service {'someservice':
ensure => $ensure,
enabled => $enabled,
...
Now you can't simply use default values of attributes from service to class,
because there is no default values. So behavior of whole class differs from
behavior of a service. And so there is a lot of problems in large installations.
See http://projects.puppetlabs.com/issues/22580 - here is one of examples.
--
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.