[chef] Re: Re: How can we send parametrs to handler?


Chronological Thread 
  • From: Ilya Maltsev < >
  • To: < >
  • Subject: [chef] Re: Re: How can we send parametrs to handler?
  • Date: Fri, 13 Apr 2012 13:39:20 +0400

Thank you!) it helps us

 

---
Best Regards,
Ilya Maltsev

Andrea Campi писал 13.04.2012 13:07:

On Fri, Apr 13, 2012 at 11:03 AM, Ilya Maltsev <
 
 ">
 > wrote:
Hello! We are writing handler(message.rb). require "rubygems" require "amqp" require "chef"  .....   class Test < Chef::Handler     def initialize(ipad)       @ipad = ipad     end     puts  @ipad   ........... end We have recipe where we call this handler: ..... include_recipe "chef_handler" chef_handler "Chef::Handler::Test" do     arguments ['something']     source "/var/chef/handlers/message.rb"     action :enable  end ......... We can't send parameters from recipe to handler,  the result of running recipe is: @ipad = nil How can we send parametrs to handler?
Is "puts @ipad" really at class scope, outside any method?
That's not what you want.

Try:

class Test < Chef::Handler
 def initialize(ipad)
   @ipad = ipad
 end

  def report
    puts  @ipad
  end
end



Archive powered by MHonArc 2.6.16.

§