Issue #9768 has been reported by Matthias Pigulla.
----------------------------------------
Feature #9768: create_resources should accept default values for all resources
it creates
https://projects.puppetlabs.com/issues/9768
Author: Matthias Pigulla
Status: Unreviewed
Priority: Normal
Assignee:
Category: functions
Target version:
Affected Puppet version:
Keywords:
Branch:
I'd like to suggest that create_resources accepts a third (optional) parameter
$defaults. $defaults should be a hash and would be merged with the individual
resource parameters before creating the resource, allowing for expressions like
define test($prefix, $message) {
notify { "$prefix $message": }
}
$hash = {
"one" => { message => "first" },
"two" => { message => "second" }
}
$default = { prefix => "test" }
create_resources("test", $hash, $default)
To give a real-life example: When you have a definition to manage a user
(account, homedir, ssh keys, ...), it is handy to write
my_user { "name":
...
sshkeys => {
"first-name" => { key => ..., type => ... },
"second-name" => { key => ..., type => ...}
}
}
In the my_user definition, <del>there is no</del> I don't see a way to
create_resources("ssh_authorized_key", $sshkeys), as the ssh_authorized_key
needs the user $name.
I will suggest a patch (pull request?) shortly.
--
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.