[chef] Re: Re: Re: Access node attributes in a library


Chronological Thread 
  • From: James Light < >
  • To:
  • Subject: [chef] Re: Re: Re: Access node attributes in a library
  • Date: Thu, 2 Aug 2012 21:30:06 -0400

Not sure if this is the problem or not, but I know in Ruby any variable name that starts with an uppercase letter is a constant.

     -JL

On Aug 2, 2012 3:47 PM, < "> > wrote:
Disclaimer: I am a Ruby newbie

Trying to follow the first option, i changed the following:
Moved the recipe function into a module
Included the module into the recipe

<code>
module LogLib
def logEvent(s)
 stomp_server = @node[:stomp_server]
 Chef::Log.info ("#{stomp_server}");
end
end

class Chef::Recipe::LOG
 include LogLib
end
</code>

But when I invoke LOG.logEvent "custom event" from a different cookbook's
recipe for testing, I got an error:
NameError: uninitialized constant Chef::Recipe::LOG::LogLib



Archive powered by MHonArc 2.6.16.

§