chef-irc-snitch 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE.txt +20 -0
- data/chef-irc-snitch.gemspec +1 -1
- data/lib/chef-irc-snitch.rb +16 -6
- data/lib/chef-irc-snitch/version.rb +1 -1
- metadata +4 -3
data/MIT-LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Sean Porter & Justin Kolberg
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/chef-irc-snitch.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.rubyforge_project = "chef-irc-snitch"
|
18
18
|
|
19
19
|
s.add_dependency('chef')
|
20
|
-
s.add_dependency('shout-bot')
|
20
|
+
s.add_dependency('shout-bot-portertech')
|
21
21
|
|
22
22
|
s.files = `git ls-files`.split("\n")
|
23
23
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/chef-irc-snitch.rb
CHANGED
@@ -8,10 +8,11 @@ require 'shout-bot'
|
|
8
8
|
|
9
9
|
class IRCSnitch < Chef::Handler
|
10
10
|
|
11
|
-
def initialize(irc_uri, github_user, github_token)
|
11
|
+
def initialize(irc_uri, github_user, github_token, ssl = false)
|
12
12
|
@irc_uri = irc_uri
|
13
13
|
@github_user = github_user
|
14
14
|
@github_token = github_token
|
15
|
+
@ssl = ssl
|
15
16
|
end
|
16
17
|
|
17
18
|
def report
|
@@ -20,7 +21,7 @@ class IRCSnitch < Chef::Handler
|
|
20
21
|
gist = "#{run_status.formatted_exception}\n\n"
|
21
22
|
gist << Array(backtrace).join("\n")
|
22
23
|
|
23
|
-
max_attempts =
|
24
|
+
max_attempts = 2
|
24
25
|
gist_id = nil
|
25
26
|
|
26
27
|
begin
|
@@ -34,18 +35,27 @@ class IRCSnitch < Chef::Handler
|
|
34
35
|
gist_id = JSON.parse(res.body)["gists"].first["repo"]
|
35
36
|
end
|
36
37
|
rescue Timeout::Error
|
37
|
-
Chef::Log.
|
38
|
+
Chef::Log.error("Timed out while attempting to create a GitHub Gist, retrying ...")
|
38
39
|
max_attempts -= 1
|
39
40
|
retry if max_attempts > 0
|
40
41
|
end
|
41
42
|
|
42
43
|
Chef::Log.info("Created a GitHub Gist @ https://gist.github.com/#{gist_id}")
|
43
44
|
|
45
|
+
max_attempts = 2
|
44
46
|
message = "Chef run failed on #{node.name} => https://gist.github.com/#{gist_id}"
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
begin
|
49
|
+
timeout(8) do
|
50
|
+
ShoutBot.shout(@irc_uri, nil, @ssl) do |channel|
|
51
|
+
channel.say message
|
52
|
+
Chef::Log.info("Informed chefs via IRC => '#{message}'")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
rescue Timeout::Error
|
56
|
+
Chef::Log.error("Timed out while attempting to message Chefs via IRC, retrying ...")
|
57
|
+
max_attempts -= 1
|
58
|
+
retry if max_attempts > 0
|
49
59
|
end
|
50
60
|
end
|
51
61
|
|
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.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sean Porter
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-06-02 00:00:00 +09:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
type: :runtime
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: shout-bot
|
28
|
+
name: shout-bot-portertech
|
29
29
|
prerelease: false
|
30
30
|
requirement: &id002 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
@@ -47,6 +47,7 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- .gitignore
|
49
49
|
- Gemfile
|
50
|
+
- MIT-LICENSE.txt
|
50
51
|
- Rakefile
|
51
52
|
- chef-irc-snitch.gemspec
|
52
53
|
- lib/chef-irc-snitch.rb
|