----- Original Message -----
> From: "Henrik Lindberg" <[email protected]>
> To: "puppet-dev" <[email protected]>
> Sent: Friday, July 31, 2015 2:10:05 PM
> Subject: [Puppet-dev] Re: Accessing resource attributes

> On 2015-31-07 12:35, R.I.Pienaar wrote:
>> I just noticed last night we can now access resource and class attributes:
>>
>>     define x($y) {
>>     }
>>
>>     x{"foo": y => "bar"}
>>
>>     notice(X["foo"]["y"])
>>
>> this works, yay with the obvious parsing order caveats.
>>
>> This works too:
>>
>>     define x($y) {
>>      notify{$name: message =>  $y }
>>     }
>>
>>     class one {
>>       x{"one": y => "hello from one"}
>>     }
>>
>>     include one
>>
>>     notice(X["one"]["y"])
>>
>> but this does not:
>>
>>      define x($y) {
>>        notify{$name: message =>  $y }
>>      }
>>
>>      x{"hello": y => "hello world"}
>>
>>      notify{"outside": message => "hello from outside"}
>>
>>      notify{X["hello"]["y"]: }
>>      notify{Notify["outside"]["message"]: } # works
>>      notify{Notify["hello"]["message"]: } # fails
>>
>> It can't find the notify inside the defined type X:
>>
>> Error: Evaluation Error: Resource not found: Notify['hello']
>>
>> commenting out the problem notify I do see:
>>
>> Notice: /Stage[main]/Main/X[hello]/Notify[hello]/message: defined 'message' 
>> as
>> 'hello world'
>>
>> which suggests I didn't mess up the resource name
>>
>> Is this a bug or just not supposed to work?
>>
> 
> You said it yourself "the obvious parsing order caveats". Afaict, the

this one wasn't obvious to me :) I did not realize its lazy evaluated
so that explains it

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/24646166.111919.1438348460192.JavaMail.zimbra%40devco.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to