Class: Chef::Handler::Xmpphandler

Inherits:
Chef::Handler show all
Defined in:
lib/chef/handler/xmpphandler.rb

Instance Method Summary collapse

Instance Method Details

#reportObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/chef/handler/xmpphandler.rb', line 9

def report
        if run_status.success?
          text = "Chef complete on #{node.name} in #{run_status.elapsed_time}"
        else
          text = "Chef failed on #{node.name} with #{run_status.exception}"
        end 
      
        jid = "[email protected]"
        pwd = "starblue45"
        
        recipients = [ "[email protected]", "[email protected]" ] 
        
        robot = Jabber::Client::new(Jabber::JID::new(jid))
        robot.connect
        robot.auth(pwd)
        
        recipients.each do |recipient|
          message = Jabber::Message::new("#{recipient}", text)
          message.set_type(:chat)
          
          robot.send message     
        end
end