Issue #15628 has been updated by eric sorenson.
Status changed from Unreviewed to Needs Decision
Assignee set to Randall Hansen
Keywords set to dsl
Yes, right now the common pattern for this amongst the puppet pro svc folk is
referred to as the "underscore-real pattern", after the workaround they use :
define my::define ($value1 = "string", $value2 = ["dummy array"]) {
$value2_real_default = [ "Real default1", "Real default2"]
if $value2[0] != "dummy array" {
$value2_real = [ $value2_real_default, $value2 ]
}
else {
$value2_real = [ $value2_real_default ]
}
notify { $title:
message => inline_template('<%= value2_real.join("\n") %>')
}
}
my::define { 'no_overrides': }
my::define { 'array_override':
value2 => [ 'New value1', 'New value2' ]
}
This is... not wonderful. It'd be nice to have some syntax for doing this but
I'm not sure what it would look like.
Randall, any thoughts? As I see it, we have a choice:
- to control it on the sending side (the `array_override` resource above would
be able to indicate that 'New value1' and 'New value2' should override whatever
`my::define` provides by default)
- control on the receiving side, where `my::define` gets to decide whether
additional parameters to `$value2` append to, rather than replacing, what _it_
thinks the defaults should be
- refine this code pattern into something polished and worth publishing but
don't make changes into the underlying implementation.
----------------------------------------
Bug #15628: Need way to pass array to class to APPEND to defaults
https://projects.puppetlabs.com/issues/15628#change-68961
Author: Bill Tong
Status: Needs Decision
Priority: Normal
Assignee: Randall Hansen
Category:
Target version:
Affected Puppet version:
Keywords: dsl
Branch:
A way to pass an array to a class so that it would APPEND that array to the
default array for that class would be excellent.
--
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.