Issue #9374 has been updated by Brice Figureau.

Status changed from Needs More Information to Rejected

I'm rejecting the bug, re-open it if you have more information.
----------------------------------------
Bug #9374: Hash Members Cannot be Used in Resource Names and Throws Confusing 
Error
https://projects.puppetlabs.com/issues/9374

Author: Brad Krane
Status: Rejected
Priority: Normal
Assignee: Brice Figureau
Category: language
Target version: 
Affected Puppet version: 2.7.1
Keywords: 
Branch: 


The following snippet exhibits unexpected behavior.

<pre>
class foo { 
  define bar ( $val ) { 
    notice("bar($val)") 
  } 
} 

$some_hash = { 'name' => "some_name" } 
foo::bar { $some_hash['name']: }
</pre>

The result of this is the very confusing and incorrect error message below:

<pre>
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource 
type foo::bar at puptest.pp:8 on node www-cms-dev
</pre>

What makes this especially odd and inconsistent is that the following works as 
you would expect:

<pre>
$some_hash = { 'name' => "some_name" } 
notice($some_hash['name'])
</pre>

So, a hash member is treated differently in the two cases contrary to the 
principle of least surprise. In the former the member value is not "expanded" 
and passed on to the resource as it's name as you would expect, but it is 
"expanded" in the case of the notice example.



-- 
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.

Reply via email to