Issue #19459 has been updated by Andrew Parker.
I'm a little concerned about making `create_resource` lax about things (or any
function for that matter). Removing restrictions like this seems to me to
usually lead to accidents where some bad data "worked" because the function
accepted it.
A more explicit way of handling this situation is making sure that the yaml
contains the information that you meant to have no parameters:
<pre>
---
myfiles:
'foo': {}
</pre>
The `{}` is a way of creating an empty hash.
----------------------------------------
Feature #19459: create_resources() should accept hash keys with no parameters
https://projects.puppetlabs.com/issues/19459#change-83997
Author: Bruno Leon
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version:
Affected Puppet version:
Keywords: create_resources
hash
Branch:
When using create_resources(), you must pass a hash as the first parameter,
each key being the title of one resource of the given type (passed as first
arg).
A key with an empty hash as its parameters translates as such in Puppet DSL:
create_resources( file, {'/tmp/foo' => {}} )
When using hiera, you would have something like:
create_resources( file, hiera('myfiles') )
And the yaml:
---
myfiles:
'foo':
This however will not be interpreted as an empty hash but rather as nil, which
in turns fail when the merge() function expects a hash:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
can't convert nil into Hash
In the specific case of create_resources(), I think that this kind of yaml
should be acceptable (otherwise you will have to pass an empty argument just
for a syntaxic issue).
I did a simple patch that addresses this issue and allow a better usage of the
create_resources() function.
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.