chef-handler-opsmatic 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/handler/opsmatic.rb +15 -8
- data/lib/chef/handler/opsmatic_version.rb +1 -1
- data/spec/opsmatic_spec.rb +2 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fde3b3f817a8f532aaa3a3137d0612e82171526a
|
4
|
+
data.tar.gz: 2ed61bf1132c0c2eeeafe161882dc62e00199f31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe69a30172592d9e0085781331459e8ea70de32e2f85d926c2f9979b66675f3e29e9d413c73d25eaed4b1e1283e84326c1ebfbe7ada9ef488bcd1661cbc41886
|
7
|
+
data.tar.gz: 3970261c0b23b9ae3053920db397cbbab14fa1da1cefcb89b20272909bdcfc911cd9418cba578ecc9f9485bf47468247571f4a1975f79b6161b7c042b6aba7e3
|
@@ -63,7 +63,7 @@ class Chef
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# if there's an exception include details in event
|
66
|
-
if !run_status.exception.nil?
|
66
|
+
if !run_status.exception.nil?
|
67
67
|
clean_exception = run_status.formatted_exception.encode('UTF-8', {:invalid => :replace, :undef => :replace, :replace => '?'})
|
68
68
|
opsmatic_event[:data][:exception] = clean_exception
|
69
69
|
end
|
@@ -109,7 +109,7 @@ class Chef
|
|
109
109
|
File.open("#{data_dir}/chef_resources.json", "w") do |f|
|
110
110
|
watchlist = []
|
111
111
|
@watch_files.keys.each do |k|
|
112
|
-
watchlist << { "path" => k }
|
112
|
+
watchlist << { "path" => k }
|
113
113
|
end
|
114
114
|
f.write({ "files" => watchlist }.to_json)
|
115
115
|
end
|
@@ -135,9 +135,9 @@ class Chef
|
|
135
135
|
end
|
136
136
|
|
137
137
|
# submit report to the opsmatic collector
|
138
|
-
def submit(event)
|
138
|
+
def submit(event)
|
139
139
|
Chef::Log.info("Posting chef run report to Opsmatic")
|
140
|
-
|
140
|
+
|
141
141
|
url = URI.parse(@config[:collector_url])
|
142
142
|
|
143
143
|
qs = url.query.nil? ? [] : url.query.split("&")
|
@@ -157,8 +157,15 @@ class Chef
|
|
157
157
|
http = Net::HTTP.new(url.host, url.port)
|
158
158
|
end
|
159
159
|
|
160
|
-
|
161
|
-
|
160
|
+
timeout = @config[:timeout]
|
161
|
+
if timeout.nil?
|
162
|
+
timeout = 5
|
163
|
+
else
|
164
|
+
timeout = Integer(timeout)
|
165
|
+
end
|
166
|
+
|
167
|
+
http.open_timeout = timeout
|
168
|
+
http.read_timeout = timeout
|
162
169
|
http.use_ssl = (url.scheme == 'https')
|
163
170
|
|
164
171
|
if not @config[:ssl_peer_verify]
|
@@ -179,7 +186,7 @@ class Chef
|
|
179
186
|
end
|
180
187
|
rescue Timeout::Error
|
181
188
|
Chef::Log.warn("Timed out connecting to Opsmatic event service, chef run wasn't recorded")
|
182
|
-
rescue Exception => msg
|
189
|
+
rescue Exception => msg
|
183
190
|
Chef::Log.warn("An unhandled execption occured while posting event to Opsmatic event service: #{msg}")
|
184
191
|
end
|
185
192
|
end
|
@@ -235,4 +242,4 @@ class Chef
|
|
235
242
|
end
|
236
243
|
end
|
237
244
|
end
|
238
|
-
end
|
245
|
+
end
|
data/spec/opsmatic_spec.rb
CHANGED
@@ -12,7 +12,8 @@ describe "Chef::Handler::Opsmatic" do
|
|
12
12
|
@handler = Chef::Handler::Opsmatic.new(
|
13
13
|
:integration_token => INTEGRATION_TOKEN,
|
14
14
|
:collector_url => COLLECTOR_URL,
|
15
|
-
:agent_dir => "/var/tmp/opsmatic"
|
15
|
+
:agent_dir => "/var/tmp/opsmatic",
|
16
|
+
:timeout => "10"
|
16
17
|
)
|
17
18
|
|
18
19
|
@node = Chef::Node.build(HOSTNAME)
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-handler-opsmatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Opsmatic Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: chef
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Chef report handler for sending run detail information to Opsmatic
|
@@ -87,7 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
-
|
90
|
+
- .gitignore
|
91
91
|
- Gemfile
|
92
92
|
- LICENSE.md
|
93
93
|
- README.md
|
@@ -107,17 +107,17 @@ require_paths:
|
|
107
107
|
- lib
|
108
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - '>='
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.1.11
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Chef report handler for sending run detail information to Opsmatic
|