chef-irc-snitch 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module Chef
2
2
  module IRC
3
3
  module Snitch
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
@@ -18,7 +18,7 @@ class IRCSnitch < Chef::Handler
18
18
  def report
19
19
  Chef::Log.error("Chef run failed @ #{Time.now.getutc}, snitchin' to chefs via IRC")
20
20
 
21
- gist = "#{run_status.formatted_exception}\n\n"
21
+ gist = "#{run_status.formatted_exception}\n"
22
22
  gist << Array(backtrace).join("\n")
23
23
 
24
24
  max_attempts = 2
@@ -30,7 +30,8 @@ class IRCSnitch < Chef::Handler
30
30
  "files[#{node.name}-#{Time.now.to_i.to_s}]" => gist,
31
31
  "login" => @github_user,
32
32
  "token" => @github_token,
33
- "description" => "Chef run failed on #{node.name} @ #{Time.now.getutc}"
33
+ "description" => "Chef run failed on #{node.name} @ #{Time.now.getutc}",
34
+ "public" => false
34
35
  })
35
36
  gist_id = JSON.parse(res.body)["gists"].first["repo"]
36
37
  end
@@ -43,13 +44,14 @@ class IRCSnitch < Chef::Handler
43
44
  Chef::Log.info("Created a GitHub Gist @ https://gist.github.com/#{gist_id}")
44
45
 
45
46
  max_attempts = 2
46
- message = "Chef run failed on #{node.name} => https://gist.github.com/#{gist_id}"
47
+ ip_address = (node.has_key? :ec2) ? node.ec2.public_ipv4 : node.ipaddress
48
+ message = "Chef run failed on #{node.name} (#{ip_address}) : https://gist.github.com/#{gist_id}"
47
49
 
48
50
  begin
49
51
  timeout(8) do
50
52
  ShoutBot.shout(@irc_uri, nil, @ssl) do |channel|
51
53
  channel.say message
52
- Chef::Log.info("Informed chefs via IRC => '#{message}'")
54
+ Chef::Log.info("Informed chefs via IRC : #{message}")
53
55
  end
54
56
  end
55
57
  rescue Timeout::Error
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: chef-irc-snitch
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sean Porter