chef_status_handler 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,22 @@
1
+ chef_status_handler: a Chef Handler for the chef_status web server
2
+
3
+ * Reports successful and failed chef client runs to a central server
4
+
5
+ == Getting Started
6
+
7
+ gem install chef_status_handler
8
+
9
+ In your client.rb:
10
+
11
+
12
+ require 'chef_status_handler'
13
+
14
+ my_handler = Medidata::ChefStatusHandler.new
15
+ my_handler.url = 'http://example.com/chef_reports.json' # No authentication
16
+ my_handler.url = 'http://user:password@example.com/chef_reports.json' # Basic auth
17
+
18
+ # Configure Chef to use your handler to notify you of failed chef runs
19
+ exception_handlers << my_handler
20
+ # Notify on successful runs
21
+ report_handlers << my_handler
22
+
@@ -0,0 +1,52 @@
1
+ Gem::Specification.new do |s|
2
+ s.specification_version = 2 if s.respond_to? :specification_version=
3
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
+ s.rubygems_version = '1.3.5'
5
+
6
+ ## Leave these as is they will be modified for you by the rake gemspec task.
7
+ ## If your rubyforge_project name is different, then edit it and comment out
8
+ ## the sub! line in the Rakefile
9
+ s.name = 'chef_status_handler'
10
+ s.version = '0.1.0'
11
+ s.date = '2011-03-20'
12
+
13
+ ## Make sure your summary is short. The description may be as long
14
+ ## as you like.
15
+ s.summary = "A Chef handler that pings a web service"
16
+ s.description = "Keep track of the status of chef runs on your nodes"
17
+
18
+ ## List the primary authors. If there are a bunch of authors, it's probably
19
+ ## better to set the email to an email list or something. If you don't have
20
+ ## a custom homepage, consider using your GitHub URL or the like.
21
+ s.authors = ["Aaron Suggs"]
22
+ s.email = 'aaron@ktheory.com'
23
+ s.homepage = 'http://github.com/ktheory/chef_status_handler'
24
+
25
+ ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
26
+ ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
27
+ s.require_paths = %w[lib]
28
+
29
+ ## This sections is only necessary if you have C extensions.
30
+ # s.require_paths << 'ext'
31
+ # s.extensions = %w[ext/extconf.rb]
32
+
33
+ ## If your gem includes any executables, list them here.
34
+ #s.executables = []
35
+ #s.default_executable = ''
36
+
37
+ ## Specify any RDoc options here. You'll want to add your README and
38
+ ## LICENSE files to the extra_rdoc_files list.
39
+ s.rdoc_options = ["--charset=UTF-8"]
40
+ s.extra_rdoc_files = %w[README.rdoc]
41
+
42
+ ## List your runtime dependencies here. Runtime dependencies are those
43
+ ## that are needed for an end user to actually USE your code.
44
+ s.add_dependency('chef', '>=0.9.0')
45
+
46
+ ## List your development dependencies here. Development dependencies are
47
+ ## those that are only needed during development
48
+ #s.add_development_dependency('rake')
49
+
50
+ s.files = `git ls-files`.split("\n")
51
+ s.test_files = `git ls-files -- {spec,tests}/*`.split("\n")
52
+ end
@@ -0,0 +1,20 @@
1
+ require 'chef/handler'
2
+ require 'net/http'
3
+ require 'uri'
4
+
5
+ module Medidata
6
+ class ChefStatusHandler < Chef::Handler
7
+ attr_accessor :url
8
+
9
+ def report
10
+ params = {"chef_report[success]" => success?, "chef_report[node]" => node.name}
11
+ Net::HTTP.post_form(parsed_url, params)
12
+ end
13
+
14
+ def parsed_url
15
+ URI.parse url
16
+ end
17
+
18
+ end
19
+ end
20
+
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chef_status_handler
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Aaron Suggs
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-20 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: chef
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 59
30
+ segments:
31
+ - 0
32
+ - 9
33
+ - 0
34
+ version: 0.9.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Keep track of the status of chef runs on your nodes
38
+ email: aaron@ktheory.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - README.rdoc
45
+ files:
46
+ - README.rdoc
47
+ - chef_status_handler.gemspec
48
+ - lib/chef_status_handler.rb
49
+ has_rdoc: true
50
+ homepage: http://github.com/ktheory/chef_status_handler
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options:
55
+ - --charset=UTF-8
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project:
79
+ rubygems_version: 1.6.2
80
+ signing_key:
81
+ specification_version: 2
82
+ summary: A Chef handler that pings a web service
83
+ test_files: []
84
+