chef-irc-snitch 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.org CHANGED
@@ -6,17 +6,17 @@
6
6
 
7
7
  ** Configure Chef to Use The Handler
8
8
 
9
- Append the following to your Chef client configs ('/etc/chef/client.rb')
9
+ Append the following to your Chef client configs, usually at =/etc/chef/client.rb=
10
10
 
11
11
  : # Notify admins via IRC when a Chef run fails
12
12
  : require 'chef-irc-snitch'
13
13
  :
14
14
  : irc_uri = "irc://nick:password@irc.domain.com:6667/#admins"
15
15
  : github_user = "foobar"
16
- : github_token = "asKkwqofovX3shBmtMf8EWhDzSr7ouUb"
16
+ : github_password = "secret"
17
17
  : enable_ssl = true
18
18
  :
19
- : irc_handler = IRCSnitch.new(irc_uri, github_user, github_token, enable_ssl)
19
+ : irc_handler = IRCSnitch.new(irc_uri, github_user, github_password, enable_ssl)
20
20
  : exception_handlers << irc_handler
21
21
 
22
22
  * License
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "chef-irc-snitch"
3
- s.version = "0.0.9"
3
+ s.version = "0.0.10"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.authors = ["Sean Porter"]
6
6
  s.email = ["portertech@gmail.com"]
@@ -8,26 +8,26 @@ require 'carrier-pigeon'
8
8
 
9
9
  class IRCSnitch < Chef::Handler
10
10
 
11
- def initialize(irc_uri, github_user, github_token, ssl = false)
11
+ def initialize(irc_uri, github_user, github_password, ssl = false)
12
12
  @irc_uri = irc_uri
13
13
  @github_user = github_user
14
- @github_token = github_token
14
+ @github_password = github_password
15
15
  @ssl = ssl
16
16
  @timestamp = Time.now.getutc
17
17
  end
18
18
 
19
- def fmt_run_list
19
+ def formatted_run_list
20
20
  node.run_list.map {|r| r.type == :role ? r.name : r.to_s }.join(', ')
21
21
  end
22
22
 
23
- def fmt_gist
23
+ def formatted_gist
24
24
  ([ "Node: #{node.name} (#{node.ipaddress})",
25
25
  "Run list: #{node.run_list}",
26
26
  "All roles: #{node.roles.join(', ')}",
27
27
  "",
28
28
  "#{run_status.formatted_exception}",
29
- ""] +
30
- Array(backtrace)).join("\n")
29
+ ""
30
+ ] + Array(backtrace)).join("\n")
31
31
  end
32
32
 
33
33
  def report
@@ -41,21 +41,21 @@ class IRCSnitch < Chef::Handler
41
41
  gist_id = nil
42
42
  begin
43
43
  timeout(10) do
44
- res = Net::HTTP.post_form(URI.parse("http://gist.github.com/api/v1/json/new"), {
45
- "files[#{node.name}-#{@timestamp.to_i.to_s}]" => fmt_gist,
44
+ response = Net::HTTP.post_form(URI.parse("http://gist.github.com/api/v1/json/new"), {
45
+ "files[#{node.name}-#{@timestamp.to_i}]" => formatted_gist,
46
46
  "login" => @github_user,
47
- "token" => @github_token,
47
+ "password" => @github_password,
48
48
  "description" => "Chef run failed on #{node.name} @ #{@timestamp}",
49
49
  "public" => false
50
50
  })
51
- gist_id = JSON.parse(res.body)["gists"].first["repo"]
51
+ gist_id = JSON.parse(response.body)["gists"].first["repo"]
52
52
  Chef::Log.info("Created a GitHub Gist @ https://gist.github.com/#{gist_id}")
53
53
  end
54
54
  rescue Timeout::Error
55
55
  Chef::Log.error("Timed out while attempting to create a GitHub Gist")
56
56
  end
57
57
 
58
- message = "Chef failed on #{node.name} (#{fmt_run_list}): https://gist.github.com/#{gist_id}"
58
+ message = "Chef failed on #{node.name} (#{formatted_run_list}): https://gist.github.com/#{gist_id}"
59
59
 
60
60
  begin
61
61
  timeout(10) do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-irc-snitch
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 9
10
- version: 0.0.9
9
+ - 10
10
+ version: 0.0.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Porter
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-06 00:00:00 -08:00
18
+ date: 2012-04-04 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency