chef-handler-opsmatic 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9cd290601d08ca313547fe3afe1ef4e467a5e166
4
+ data.tar.gz: 1bf74ea6323c74099f49e9d1ea7d207a4a7bbbbf
5
+ SHA512:
6
+ metadata.gz: 449618778e86eb232dc76e8dadc66858207c3478ca8ab4df640f95926debd4b2d619c873d7283bb0a61353cbba7f69f8dcefabbf96cbd3ca5ff8626d9bf38801
7
+ data.tar.gz: 797726fd4510c28053fcd7630f5742ebaff639c1f0353b03d81df73cd82fef89a4f583cfb12f90a0d8326d2b7a374deb5e0436c92f1f8de5717236f520ed30e3
@@ -6,7 +6,7 @@ require 'chef/handler/opsmatic_version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "chef-handler-opsmatic"
8
8
  spec.version = Chef::Handler::Opsmatic::VERSION
9
- spec.authors = ["Marcus Barczak"]
9
+ spec.authors = ["Opsmatic Engineering"]
10
10
  spec.email = ["support@opsmatic.com"]
11
11
  spec.summary = %q{Chef report handler for sending run detail information to Opsmatic}
12
12
  spec.description = %q{Chef report handler for sending run detail information to Opsmatic}
@@ -72,6 +72,9 @@ class Chef
72
72
 
73
73
  # submit our event
74
74
  submit opsmatic_event
75
+
76
+ # write the node attributes to a json file for the agent
77
+ write_attributes
75
78
  end
76
79
 
77
80
  # collects up details on file resources managed by chef on the host and writes
@@ -177,6 +180,33 @@ class Chef
177
180
  Chef::Log.warn("An unhandled execption occured while posting event to Opsmatic event service: #{msg}")
178
181
  end
179
182
  end
183
+
184
+ def write_attributes()
185
+ ext_dir = "#{@config[:agent_dir]}/user_data/metadata"
186
+ unless File.exists?(ext_dir)
187
+ FileUtils.mkdir_p(ext_dir)
188
+ end
189
+
190
+ begin
191
+ node_json = Chef::JSONCompat.to_json_pretty(data[:node])
192
+ hash = JSON.parse(node_json)
193
+ hash.delete("automatic")
194
+ file_json = hash.to_json
195
+ rescue Exception => msg
196
+ Chef::Log.warn("An unhandled execption while preparing to write node data: #{msg}")
197
+ return
198
+ end
199
+
200
+ begin
201
+ filename = File.join(ext_dir, "chef_attributes.json")
202
+ File.open(filename, "w") do |file|
203
+ file.puts file_json
204
+ end
205
+ rescue Exception => msg
206
+ Chef::Log.warn("An unhandled execption while writing to #{filename}: #{msg}")
207
+ return
208
+ end
209
+ end
180
210
  end
181
211
  end
182
212
  end
@@ -1,7 +1,7 @@
1
1
  class Chef
2
2
  class Handler
3
3
  class Opsmatic < ::Chef::Handler
4
- VERSION = "0.0.14"
4
+ VERSION = "0.0.15"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,94 +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.14
5
- prerelease:
4
+ version: 0.0.15
6
5
  platform: ruby
7
6
  authors:
8
- - Marcus Barczak
7
+ - Opsmatic Engineering
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-11-11 00:00:00.000000000 Z
11
+ date: 2015-02-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.6'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.6'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: chef
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: webmock
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  description: Chef report handler for sending run detail information to Opsmatic
@@ -98,7 +87,7 @@ executables: []
98
87
  extensions: []
99
88
  extra_rdoc_files: []
100
89
  files:
101
- - .gitignore
90
+ - ".gitignore"
102
91
  - Gemfile
103
92
  - LICENSE.md
104
93
  - README.md
@@ -111,34 +100,28 @@ files:
111
100
  homepage: https://github.com/opsmatic/chef-handler-opsmatic
112
101
  licenses:
113
102
  - MIT
103
+ metadata: {}
114
104
  post_install_message:
115
105
  rdoc_options: []
116
106
  require_paths:
117
107
  - lib
118
108
  required_ruby_version: !ruby/object:Gem::Requirement
119
- none: false
120
109
  requirements:
121
- - - ! '>='
110
+ - - ">="
122
111
  - !ruby/object:Gem::Version
123
112
  version: '0'
124
- segments:
125
- - 0
126
- hash: -881451571111827738
127
113
  required_rubygems_version: !ruby/object:Gem::Requirement
128
- none: false
129
114
  requirements:
130
- - - ! '>='
115
+ - - ">="
131
116
  - !ruby/object:Gem::Version
132
117
  version: '0'
133
- segments:
134
- - 0
135
- hash: -881451571111827738
136
118
  requirements: []
137
119
  rubyforge_project:
138
- rubygems_version: 1.8.23.2
120
+ rubygems_version: 2.4.1
139
121
  signing_key:
140
- specification_version: 3
122
+ specification_version: 4
141
123
  summary: Chef report handler for sending run detail information to Opsmatic
142
124
  test_files:
143
125
  - spec/opsmatic_spec.rb
144
126
  - spec/spec_helper.rb
127
+ has_rdoc: