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


Chronological Thread 
  • From: < >
  • To:
  • Subject: [chef] Re: Re: Access node attributes in a library
  • Date: Thu, 2 Aug 2012 12:32:34 -0700 (PDT)

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.

§