chef-handler-datadog 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzlmYzNiOWYxODgxODhmZjNmY2Y3OTE1MGQ1MTlhMjMxNTA4M2NiZA==
5
+ data.tar.gz: !binary |-
6
+ ODljYmFlYjg5Y2UyMDQ2OWQ2NjlkNzM4OGFkN2FkYmM5ZmEwMDQ1Yg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YzNiODIxMTI1NTg1ZjNmYTdmZWEyMDVjYzRhOTY1OGViMjc5MDYyZDczNDBl
10
+ ZTVlYzM3YzFkZGI3OWUxMjlmNjcyNzMzNjMzMzQ3YmQyYTJhOWMxNmY3ZjU4
11
+ ZjA1MjFlMGZmY2MyMGJmZmUwZGEyYTI1MTIzNWM5MDU5NTIwNzE=
12
+ data.tar.gz: !binary |-
13
+ NGNjYzFmNWI4OTJlNzZlYzFmMjA2NmFmYTRhZTc1M2YwMTg4MDMxZjBkYmJh
14
+ ZmNkMGY0ZTdlMjhlODAzODM4NGE3M2FkNDQxNGQ5NzNiMjAwNzgwNDc4ZGUz
15
+ MTE4NzZmYzM1YjQzMGQ2MWE2Yjc5MWEwNDQxZTk1MjAxOGE1MWI=
data/.gitignore CHANGED
@@ -53,3 +53,8 @@ pkg
53
53
  json
54
54
  rake
55
55
  Gemfile.lock
56
+
57
+ # For Ruby Managers:
58
+ .ruby-gemset
59
+ .ruby-version
60
+ .rvmrc
data/.travis.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
- before_install: gem update --system 1.8.25
5
4
  gemfile:
6
5
  - gemfiles/Gemfile.chef-11
7
6
  - gemfiles/Gemfile.chef-10
data/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ Changes
2
+ =======
3
+ # 0.2.0 / 2013-10-31
4
+
5
+ * [BUGFIX] moved Chef gem dependency to development, [#34][] [@miketheman][]
6
+ * [BUGFIX] redis python client check was not properly checking the default version, [@remh][]
7
+ * [MISC] tailor 1.3.1 caught some cosmetic issue, [@alq][]
8
+ * [MISC] fixed a few repo & build issues, [@miketheman][]
9
+
10
+ # 0.1.2 / 2013-04-03
11
+
12
+ And all other versions were prior to this. See git history for more.
13
+ <!--- The following link definition list is generated by PimpMyChangelog --->
14
+ [#34]: https://github.com/DataDog/chef-handler-datadog/issues/34
15
+ [@alq]: https://github.com/alq
16
+ [@miketheman]: https://github.com/miketheman
17
+ [@remh]: https://github.com/remh
data/README.md CHANGED
@@ -6,7 +6,7 @@ An Exception and Report Handler for Chef.
6
6
 
7
7
  ## Using chef-handler-datadog
8
8
 
9
- The [Chef integration page](https://app.datadoghq.com/accounts/settings#integrations) has detailed instructions.
9
+ The Datadog Docs on [Chef](http://docs.datadoghq.com/guides/chef/#deployhandler) has detailed instructions.
10
10
 
11
11
  ## Contributing to chef-handler-datadog
12
12
 
@@ -20,4 +20,4 @@ The [Chef integration page](https://app.datadoghq.com/accounts/settings#integrat
20
20
 
21
21
  ## Copyright
22
22
 
23
- Copyright (c) 2012 Datadog, Inc. See LICENSE.txt for further details.
23
+ Copyright (c) 2012-2013 Datadog, Inc. See LICENSE.txt for further details.
data/Rakefile CHANGED
@@ -3,21 +3,15 @@
3
3
  require 'rubygems'
4
4
  require 'bundler/gem_tasks'
5
5
 
6
- require 'rake/testtask'
7
- Rake::TestTask.new(:test) do |test|
8
- test.libs << 'lib' << 'test'
9
- test.pattern = 'test/**/test_*.rb'
10
- test.verbose = true
11
- end
6
+ require 'rspec/core/rake_task'
7
+ require 'tailor/rake_task'
12
8
 
13
9
  task :default => :test
14
10
 
15
- require 'rdoc/task'
16
- RDoc::Task.new do |rdoc|
17
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
11
+ RSpec::Core::RakeTask.new(:spec)
18
12
 
19
- rdoc.rdoc_dir = 'rdoc'
20
- rdoc.title = "chef-handler-datadog #{version}"
21
- rdoc.rdoc_files.include('README*')
22
- rdoc.rdoc_files.include('lib/**/*.rb')
13
+ Tailor::RakeTask.new do |task|
14
+ task.file_set('lib/**/*.rb', "code") do |style|
15
+ style.max_line_length 160, :level => :warn
16
+ end
23
17
  end
@@ -13,13 +13,13 @@ Gem::Specification.new do |gem|
13
13
  gem.require_paths = ['lib']
14
14
  gem.extra_rdoc_files = ['README.md', 'LICENSE.txt']
15
15
 
16
- gem.add_dependency 'chef', ">= 10", "<= 12"
17
16
  gem.add_dependency 'dogapi', ">= 1.2"
18
17
 
19
- gem.add_development_dependency 'rake'
20
- gem.add_development_dependency 'shoulda'
21
18
  gem.add_development_dependency 'bundler'
22
- gem.add_development_dependency 'rdoc'
19
+ gem.add_development_dependency 'chef', ">= 10", "<= 12"
20
+ gem.add_development_dependency 'rake'
21
+ gem.add_development_dependency 'rspec'
22
+ gem.add_development_dependency 'tailor', '~> 1.3'
23
23
  gem.add_development_dependency 'travis-lint'
24
24
 
25
25
  gem.authors = ["Mike Fiedler", "Adam Jacob", "Alexis Le-Quoc"]
@@ -1,3 +1,3 @@
1
1
  module ChefHandlerDatadog
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -20,6 +20,7 @@ class Chef
20
20
  end
21
21
 
22
22
  def report
23
+ # resolve correct hostname
23
24
  hostname = run_status.node.name
24
25
  if @use_ec2_instance_id && run_status.node.attribute?("ec2") && run_status.node.ec2.attribute?("instance_id")
25
26
  hostname = run_status.node.ec2.instance_id
@@ -35,6 +36,7 @@ class Chef
35
36
  Chef::Log.error("Could not send metrics to Datadog. Connection error:\n" + e)
36
37
  end
37
38
 
39
+ # Build the correct event
38
40
  event_title = ""
39
41
  run_time = pluralize(run_status.elapsed_time, "second")
40
42
  if run_status.success?
@@ -65,13 +67,14 @@ class Chef
65
67
  begin
66
68
  # Send the Event data
67
69
  evt = @dog.emit_event(Dogapi::Event.new(event_data,
68
- :msg_title => event_title,
69
- :event_type => 'config_management.run',
70
- :event_object => hostname,
71
- :alert_type => alert_type,
72
- :priority => event_priority,
73
- :source_type_name => 'chef'
74
- ), :host => hostname)
70
+ :msg_title => event_title,
71
+ :event_type => 'config_management.run',
72
+ :event_object => hostname,
73
+ :alert_type => alert_type,
74
+ :priority => event_priority,
75
+ :source_type_name => 'chef'
76
+ ), :host => hostname)
77
+
75
78
  begin
76
79
  # FIXME nice-to-have: abstract format of return value away a bit
77
80
  # in dogapi directly. See https://github.com/DataDog/dogapi-rb/issues/18
@@ -110,7 +113,7 @@ class Chef
110
113
  if @application_key.nil?
111
114
  Chef::Log.warn("You need an application key to let Chef tag your nodes " \
112
115
  "in Datadog. Visit https://app.datadoghq.com/account/settings#api to " \
113
- "create one and update your datadog attributes in the datadog cookbook."
116
+ "create one and update your datadog attributes in the datadog cookbook."
114
117
  )
115
118
  else
116
119
  # Replace all tags with the new tags
@@ -121,7 +124,7 @@ class Chef
121
124
  Chef::Log.warn("Unexpected response from Datadog Event API: #{evt}")
122
125
  else
123
126
  if rc[0].to_i / 100 != 2
124
- Chef::Log.warn("Could not submit #{chef_roles} tags for #{hostname} to Datadog")
127
+ Chef::Log.warn("Could not submit #{new_host_tags} tags for #{hostname} to Datadog: #{evt}")
125
128
  else
126
129
  Chef::Log.debug("Successfully updated #{hostname}'s tags to #{new_host_tags.join(', ')}")
127
130
  end
@@ -156,8 +159,9 @@ class Chef
156
159
  end
157
160
  end
158
161
 
162
+ # TODO: Remove this once confirmed that Chef 0.9.x is no longer used.
159
163
  ## This function is to mimic behavior built into a later version of chef than 0.9.x
160
- ## Source is here: https://github.com/opscode/chef/blob/master/chef/lib/chef/resource.rb#L415-424
164
+ ## Source is here: https://github.com/opscode/chef/blob/19bc40b148f3862ce88d044e600d01a9838c60bc/chef/lib/chef/resource.rb#L375-L384
161
165
  ## Including this based on help from schisamo
162
166
  def defined_at(resource)
163
167
  cookbook_name = resource.cookbook_name
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-handler-datadog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mike Fiedler
@@ -11,66 +10,59 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2013-04-03 00:00:00.000000000 Z
13
+ date: 2013-10-31 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
- name: chef
16
+ name: dogapi
18
17
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
18
  requirements:
21
19
  - - ! '>='
22
20
  - !ruby/object:Gem::Version
23
- version: '10'
24
- - - <=
25
- - !ruby/object:Gem::Version
26
- version: '12'
21
+ version: '1.2'
27
22
  type: :runtime
28
23
  prerelease: false
29
24
  version_requirements: !ruby/object:Gem::Requirement
30
- none: false
31
25
  requirements:
32
26
  - - ! '>='
33
27
  - !ruby/object:Gem::Version
34
- version: '10'
35
- - - <=
36
- - !ruby/object:Gem::Version
37
- version: '12'
28
+ version: '1.2'
38
29
  - !ruby/object:Gem::Dependency
39
- name: dogapi
30
+ name: bundler
40
31
  requirement: !ruby/object:Gem::Requirement
41
- none: false
42
32
  requirements:
43
33
  - - ! '>='
44
34
  - !ruby/object:Gem::Version
45
- version: '1.2'
46
- type: :runtime
35
+ version: '0'
36
+ type: :development
47
37
  prerelease: false
48
38
  version_requirements: !ruby/object:Gem::Requirement
49
- none: false
50
39
  requirements:
51
40
  - - ! '>='
52
41
  - !ruby/object:Gem::Version
53
- version: '1.2'
42
+ version: '0'
54
43
  - !ruby/object:Gem::Dependency
55
- name: rake
44
+ name: chef
56
45
  requirement: !ruby/object:Gem::Requirement
57
- none: false
58
46
  requirements:
59
47
  - - ! '>='
60
48
  - !ruby/object:Gem::Version
61
- version: '0'
49
+ version: '10'
50
+ - - <=
51
+ - !ruby/object:Gem::Version
52
+ version: '12'
62
53
  type: :development
63
54
  prerelease: false
64
55
  version_requirements: !ruby/object:Gem::Requirement
65
- none: false
66
56
  requirements:
67
57
  - - ! '>='
68
58
  - !ruby/object:Gem::Version
69
- version: '0'
59
+ version: '10'
60
+ - - <=
61
+ - !ruby/object:Gem::Version
62
+ version: '12'
70
63
  - !ruby/object:Gem::Dependency
71
- name: shoulda
64
+ name: rake
72
65
  requirement: !ruby/object:Gem::Requirement
73
- none: false
74
66
  requirements:
75
67
  - - ! '>='
76
68
  - !ruby/object:Gem::Version
@@ -78,15 +70,13 @@ dependencies:
78
70
  type: :development
79
71
  prerelease: false
80
72
  version_requirements: !ruby/object:Gem::Requirement
81
- none: false
82
73
  requirements:
83
74
  - - ! '>='
84
75
  - !ruby/object:Gem::Version
85
76
  version: '0'
86
77
  - !ruby/object:Gem::Dependency
87
- name: bundler
78
+ name: rspec
88
79
  requirement: !ruby/object:Gem::Requirement
89
- none: false
90
80
  requirements:
91
81
  - - ! '>='
92
82
  - !ruby/object:Gem::Version
@@ -94,31 +84,27 @@ dependencies:
94
84
  type: :development
95
85
  prerelease: false
96
86
  version_requirements: !ruby/object:Gem::Requirement
97
- none: false
98
87
  requirements:
99
88
  - - ! '>='
100
89
  - !ruby/object:Gem::Version
101
90
  version: '0'
102
91
  - !ruby/object:Gem::Dependency
103
- name: rdoc
92
+ name: tailor
104
93
  requirement: !ruby/object:Gem::Requirement
105
- none: false
106
94
  requirements:
107
- - - ! '>='
95
+ - - ~>
108
96
  - !ruby/object:Gem::Version
109
- version: '0'
97
+ version: '1.3'
110
98
  type: :development
111
99
  prerelease: false
112
100
  version_requirements: !ruby/object:Gem::Requirement
113
- none: false
114
101
  requirements:
115
- - - ! '>='
102
+ - - ~>
116
103
  - !ruby/object:Gem::Version
117
- version: '0'
104
+ version: '1.3'
118
105
  - !ruby/object:Gem::Dependency
119
106
  name: travis-lint
120
107
  requirement: !ruby/object:Gem::Requirement
121
- none: false
122
108
  requirements:
123
109
  - - ! '>='
124
110
  - !ruby/object:Gem::Version
@@ -126,7 +112,6 @@ dependencies:
126
112
  type: :development
127
113
  prerelease: false
128
114
  version_requirements: !ruby/object:Gem::Requirement
129
- none: false
130
115
  requirements:
131
116
  - - ! '>='
132
117
  - !ruby/object:Gem::Version
@@ -143,6 +128,7 @@ extra_rdoc_files:
143
128
  files:
144
129
  - .gitignore
145
130
  - .travis.yml
131
+ - CHANGELOG.md
146
132
  - Gemfile
147
133
  - LICENSE.txt
148
134
  - README.md
@@ -157,27 +143,26 @@ files:
157
143
  homepage: http://www.datadoghq.com/
158
144
  licenses:
159
145
  - BSD
146
+ metadata: {}
160
147
  post_install_message:
161
148
  rdoc_options: []
162
149
  require_paths:
163
150
  - lib
164
151
  required_ruby_version: !ruby/object:Gem::Requirement
165
- none: false
166
152
  requirements:
167
153
  - - ! '>='
168
154
  - !ruby/object:Gem::Version
169
155
  version: '0'
170
156
  required_rubygems_version: !ruby/object:Gem::Requirement
171
- none: false
172
157
  requirements:
173
158
  - - ! '>='
174
159
  - !ruby/object:Gem::Version
175
160
  version: '0'
176
161
  requirements: []
177
162
  rubyforge_project:
178
- rubygems_version: 1.8.23
163
+ rubygems_version: 2.0.5
179
164
  signing_key:
180
- specification_version: 3
165
+ specification_version: 4
181
166
  summary: Chef Handler for DataDog events and metrics
182
167
  test_files:
183
168
  - test/helper.rb