Class: Chef::Handler::SpinupComplete

Inherits:
Chef::Handler show all
Defined in:
lib/chef-handler-spinup-complete.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ SpinupComplete

Returns a new instance of SpinupComplete.



32
33
34
# File 'lib/chef-handler-spinup-complete.rb', line 32

def initialize(opts={})
  @handlers = opts.fetch(:handlers, ['default'])
end

Instance Method Details

#reportObject



36
37
38
39
40
41
42
43
44
45
# File 'lib/chef-handler-spinup-complete.rb', line 36

def report
  begin
    sock = TCPSocket.new('127.0.0.1', 3030)
    sock.write(warn_first)
    sock.write(ok_second)
    sock.close
  rescue Errno::ECONNREFUSED
    Chef::Log.error("Couldn't write to the Sensu client socket")
  end
end