I''m trying to set up some classes where there is a default action that
is
applied to everything in a base class. And then have a subclass that can
override the default action for specific resources. I am using this blog
post as
inspiration:
http://www.craigdunn.org/2011/09/puppet-parameterized-classes-vs-definitions/
I created a test case of what I''m trying to achieve but the part where
I''m
overriding the value does not seem to take effect. Please let me know
what I''m doing wrong.
class example_env ( $env = ''default'' ) {
# Set $env and do something with it
notify {"Env: ${env}": }
#file {...}
}
class example_setdefault {
# Instantiate example_env class with default value
class { example_env: }
}
class example_override inherits example_setdefault {
# Override example_env class env param with new value
Class["example_env"] { env => ''orverride''}
}
class example_base {
# Base class that is included to just about everyone
# Set default value
include example_setdefault
}
class example_sub {
# Sub class that includes base class
include example_base
# Override default value
include example_override
}
node "example1" {
# host with default config
include example_base
}
node "example2" {
# host with override config
include example_sub
}
When you run this as example2 it still shows $env being
''default''. Please
let me know where I went wrong. Thanks.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/Oijycw-YmWYJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.