chef-irc-snitch 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.org +4 -0
- data/chef-irc-snitch.gemspec +1 -1
- data/lib/chef-irc-snitch.rb +17 -7
- metadata +23 -4
data/README.org
CHANGED
@@ -18,3 +18,7 @@ Append the following to your Chef client configs ('/etc/chef/client.rb')
|
|
18
18
|
:
|
19
19
|
: irc_handler = IRCSnitch.new(irc_uri, github_user, github_token, enable_ssl)
|
20
20
|
: exception_handlers << irc_handler
|
21
|
+
|
22
|
+
* License
|
23
|
+
|
24
|
+
Chef-IRC-Snitch is released under the [[https://github.com/portertech/chef-irc-snitch/blob/master/MIT-LICENSE.txt][MIT license]].
|
data/chef-irc-snitch.gemspec
CHANGED
data/lib/chef-irc-snitch.rb
CHANGED
@@ -16,22 +16,33 @@ class IRCSnitch < Chef::Handler
|
|
16
16
|
@timestamp = Time.now.getutc
|
17
17
|
end
|
18
18
|
|
19
|
+
def fmt_run_list
|
20
|
+
node.run_list.map {|r| r.type == :role ? r.name : r.to_s }.join(', ')
|
21
|
+
end
|
22
|
+
|
23
|
+
def fmt_gist
|
24
|
+
([ "Node: #{node.name} (#{node.ipaddress})",
|
25
|
+
"Run list: #{node.run_list}",
|
26
|
+
"All roles: #{node.roles.join(', ')}",
|
27
|
+
"",
|
28
|
+
"#{run_status.formatted_exception}",
|
29
|
+
""] +
|
30
|
+
Array(backtrace)).join("\n")
|
31
|
+
end
|
32
|
+
|
19
33
|
def report
|
20
|
-
message = "#{run_status.formatted_exception}\n"
|
21
|
-
message << Array(backtrace).join("\n")
|
22
34
|
|
23
35
|
if STDOUT.tty?
|
24
36
|
Chef::Log.error("Chef run failed @ #{@timestamp}")
|
25
|
-
|
37
|
+
Chef::Log.error("#{run_status.formatted_exception}")
|
26
38
|
else
|
27
39
|
Chef::Log.error("Chef run failed @ #{@timestamp}, snitchin' to chefs via IRC")
|
28
40
|
|
29
41
|
gist_id = nil
|
30
|
-
|
31
42
|
begin
|
32
43
|
timeout(10) do
|
33
44
|
res = Net::HTTP.post_form(URI.parse("http://gist.github.com/api/v1/json/new"), {
|
34
|
-
"files[#{node.name}-#{@timestamp.to_i.to_s}]" =>
|
45
|
+
"files[#{node.name}-#{@timestamp.to_i.to_s}]" => fmt_gist,
|
35
46
|
"login" => @github_user,
|
36
47
|
"token" => @github_token,
|
37
48
|
"description" => "Chef run failed on #{node.name} @ #{@timestamp}",
|
@@ -44,8 +55,7 @@ class IRCSnitch < Chef::Handler
|
|
44
55
|
Chef::Log.error("Timed out while attempting to create a GitHub Gist")
|
45
56
|
end
|
46
57
|
|
47
|
-
|
48
|
-
message = "Chef run failed on #{node.name} : #{ip_address} : #{node.roles.join(", ")} : https://gist.github.com/#{gist_id}"
|
58
|
+
message = "Chef failed on #{node.name} (#{fmt_run_list}): https://gist.github.com/#{gist_id}"
|
49
59
|
|
50
60
|
begin
|
51
61
|
timeout(10) do
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-irc-snitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 13
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Sean Porter
|
@@ -10,7 +15,8 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date:
|
18
|
+
date: 2012-03-06 00:00:00 -08:00
|
19
|
+
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: chef
|
@@ -20,6 +26,9 @@ dependencies:
|
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
23
32
|
version: "0"
|
24
33
|
type: :runtime
|
25
34
|
version_requirements: *id001
|
@@ -31,6 +40,9 @@ dependencies:
|
|
31
40
|
requirements:
|
32
41
|
- - ">="
|
33
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
34
46
|
version: "0"
|
35
47
|
type: :runtime
|
36
48
|
version_requirements: *id002
|
@@ -51,6 +63,7 @@ files:
|
|
51
63
|
- Rakefile
|
52
64
|
- chef-irc-snitch.gemspec
|
53
65
|
- lib/chef-irc-snitch.rb
|
66
|
+
has_rdoc: true
|
54
67
|
homepage: https://github.com/portertech/chef-irc-snitch
|
55
68
|
licenses:
|
56
69
|
- MIT
|
@@ -64,17 +77,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
77
|
requirements:
|
65
78
|
- - ">="
|
66
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
67
83
|
version: "0"
|
68
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
85
|
none: false
|
70
86
|
requirements:
|
71
87
|
- - ">="
|
72
88
|
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
73
92
|
version: "0"
|
74
93
|
requirements: []
|
75
94
|
|
76
95
|
rubyforge_project: chef-irc-snitch
|
77
|
-
rubygems_version: 1.
|
96
|
+
rubygems_version: 1.3.7
|
78
97
|
signing_key:
|
79
98
|
specification_version: 3
|
80
99
|
summary: An exception handler for OpsCode Chef runs (GitHub Gists & IRC)
|