- From: Jamie Winsor <
>
- To:
- Subject: [chef] Re: Access node attributes in a library
- Date: Thu, 2 Aug 2012 12:16:41 -0700
You can access node attributes within a library if you do one of two things:
1. If your library is a module you can include it into Chef::Recipe which will give you access to the node by the node function
2. You can pass the node into your function and access it within the scope of that function.
--
Jamie Winsor
@resetexistence
https://github.com/reset
On Thursday, August 2, 2012 at 11:58 AM,
wrote:
Can we access node attributes in a library? In the sample below, I get an error
NoMethodError: undefined method `[]' for nil:NilClass on the stomp_server
variable assignment line
<code>
class Chef::Recipe::LOG
def self.logEvent(s)
stomp_server = @node[:stomp_server]
end
end
</code>
Archive powered by MHonArc 2.6.16.