ohai 7.2.4 → 7.4.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a1d023b6ada45bf854a31175dc2619b818ad414
4
- data.tar.gz: c8814f952653d4d0f575cf555000f5f78109621d
3
+ metadata.gz: 6a864549f45c283240a351625851c0fe969546fd
4
+ data.tar.gz: 8aae976df05dfd28e1993d361a3d9d3a60052a89
5
5
  SHA512:
6
- metadata.gz: 16f20dda963e4624a86939379bdbb17862d6c76fdaff24f608763105e07fda9beafffb3640d0cbc8fd74f301fbd1c401bf4f7766ea5eb88e922992b513b19c41
7
- data.tar.gz: aa955999197d306f23741d20c0c961285fc5094bb34ac461a7c24b39f67598f7bb4c080366213594507aae2ac467b37cd387af47aed290e9e105ec85bab6ee80
6
+ metadata.gz: 12ed1f0c3f024cfd4422774d68b43d50ed0d765e784a29ed2b8ab24a998e7af72b71e39dae753af2bfdf4b55c8a38ed6ceae03756c7cc2c9af6ad2ca784eb2a1
7
+ data.tar.gz: deb8a94aa22889f70179c5e5c005918c74330a468016e8711ddbafd32285959524df22aca394c44f78fd52f165d61bca5cdfb76e9657e2a9d4b30d37c75b05b5
@@ -0,0 +1,62 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2014 Chef Software, Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ Ohai.plugin(:Powershell) do
19
+ provides "languages/powershell"
20
+ depends "languages"
21
+
22
+ collect_data(:windows) do
23
+ powershell = Mash.new
24
+ so = shell_out("powershell.exe -NoLogo -NonInteractive -NoProfile -command $PSVersionTable")
25
+ # Sample output:
26
+ #
27
+ # Name Value
28
+ # ---- -----
29
+ # PSVersion 4.0
30
+ # WSManStackVersion 3.0
31
+ # SerializationVersion 1.1.0.1
32
+ # CLRVersion 4.0.30319.34014
33
+ # BuildVersion 6.3.9600.16394
34
+ # PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
35
+ # PSRemotingProtocolVersion 2.2
36
+
37
+ if so.exitstatus == 0
38
+ version_info = {}
39
+ so.stdout.strip.each_line do |line|
40
+ kv = line.strip.split(/\s+/, 2)
41
+ version_info[kv[0]] = kv[1] if kv.length == 2
42
+ end
43
+ powershell[:version] = version_info['PSVersion']
44
+ powershell[:ws_man_stack_version] = version_info['WSManStackVersion']
45
+ powershell[:serialization_version] = version_info['SerializationVersion']
46
+ powershell[:clr_version] = version_info['CLRVersion']
47
+ powershell[:build_version] = version_info['BuildVersion']
48
+ powershell[:compatible_versions] = parse_compatible_versions(version_info['PSCompatibleVersions'])
49
+ powershell[:remoting_protocol_version] = version_info['PSRemotingProtocolVersion']
50
+ languages[:powershell] = powershell if powershell[:version]
51
+ end
52
+ end
53
+
54
+ def parse_compatible_versions(versions_str)
55
+ if versions_str
56
+ if versions_str.strip.start_with?('{') && versions_str.end_with?('}')
57
+ versions = versions_str.gsub(/[{}\s]+/,'').split(',')
58
+ versions if versions.length
59
+ end
60
+ end
61
+ end
62
+ end
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = '7.2.4'
21
+ VERSION = '7.4.0.rc.0'
22
22
  end
@@ -0,0 +1,82 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2014 Chef Software, Inc.
3
+ #
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
20
+
21
+ describe Ohai::System, 'languages plugin' do
22
+ VERSION_MATCHING_REGEX = /^(?:[\d]+\.)+[\d]+$/
23
+ describe 'powershell plugin', :windows_only do
24
+ RSpec.shared_examples "a version looking thing" do
25
+ it 'should be present' do
26
+ subject.should_not be_nil
27
+ end
28
+ it 'should look like a version' do
29
+ subject.should match(VERSION_MATCHING_REGEX)
30
+ end
31
+ end
32
+ before(:all) do
33
+ @plugin = get_plugin("powershell")
34
+ @plugin[:languages] = Mash.new
35
+ @plugin.run
36
+ end
37
+
38
+ subject { @plugin[:languages][:powershell] }
39
+
40
+ it 'should have information about powershell' do
41
+ subject.should_not be_nil
42
+ end
43
+
44
+ describe :version do
45
+ subject { @plugin.languages[:powershell][described_class] }
46
+ it_behaves_like 'a version looking thing'
47
+ end
48
+
49
+ describe :ws_man_stack_version do
50
+ subject { @plugin.languages[:powershell][described_class] }
51
+ it_behaves_like 'a version looking thing'
52
+ end
53
+
54
+ describe :serialization_version do
55
+ subject { @plugin.languages[:powershell][described_class] }
56
+ it_behaves_like 'a version looking thing'
57
+ end
58
+
59
+ describe :clr_version do
60
+ subject { @plugin.languages[:powershell][described_class] }
61
+ it_behaves_like 'a version looking thing'
62
+ end
63
+
64
+ describe :build_version do
65
+ subject { @plugin.languages[:powershell][described_class] }
66
+ it_behaves_like 'a version looking thing'
67
+ end
68
+
69
+ describe :remoting_protocol_version do
70
+ subject { @plugin.languages[:powershell][described_class] }
71
+ it_behaves_like 'a version looking thing'
72
+ end
73
+
74
+ describe :compatible_versions do
75
+ it 'has compatible_versions that look like versions' do
76
+ @plugin.languages[:powershell][described_class].each do |version|
77
+ version.should match(VERSION_MATCHING_REGEX)
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,68 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2014 Chef Software, Inc
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb'))
19
+
20
+ describe Ohai::System, "plugin powershell" do
21
+ before do
22
+ stub_const('::RbConfig::CONFIG', {'host_os' => 'windows'})
23
+ end
24
+
25
+ before(:each) do
26
+ @plugin = get_plugin("powershell")
27
+ @plugin[:languages] = Mash.new
28
+ end
29
+
30
+ it "should set languages[:powershell][:version] for v4" do
31
+
32
+ v4_output = <<END
33
+
34
+ Name Value
35
+ ---- -----
36
+ PSVersion 4.0
37
+ WSManStackVersion 3.0
38
+ SerializationVersion 1.1.0.1
39
+ CLRVersion 4.0.30319.34014
40
+ BuildVersion 6.3.9600.16394
41
+ PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
42
+ PSRemotingProtocolVersion 2.2
43
+
44
+ END
45
+
46
+ @plugin.stub(:shell_out).with(anything()).and_return(mock_shell_out(0, v4_output, ""))
47
+ @plugin.run
48
+ @plugin.languages[:powershell][:version].should eql("4.0")
49
+ @plugin.languages[:powershell][:ws_man_stack_version].should eql("3.0")
50
+ @plugin.languages[:powershell][:serialization_version].should eql("1.1.0.1")
51
+ @plugin.languages[:powershell][:clr_version].should eql("4.0.30319.34014")
52
+ @plugin.languages[:powershell][:build_version].should eql("6.3.9600.16394")
53
+ @plugin.languages[:powershell][:compatible_versions].should eql(['1.0', '2.0', '3.0', '4.0'])
54
+ @plugin.languages[:powershell][:remoting_protocol_version].should eql("2.2")
55
+ end
56
+
57
+ it "should not set the languages[:powershell] tree up if powershell command fails" do
58
+ error_output = <<END
59
+ 'powershell.exe' is not recognized as an internal or external command,
60
+ operable program or batch file.
61
+ END
62
+
63
+ @plugin.stub(:shell_out).with(anything).and_return(mock_shell_out(1, error_output, ""))
64
+ @plugin.run
65
+ @plugin.languages.should_not have_key(:powershell)
66
+ end
67
+
68
+ end
metadata CHANGED
@@ -1,251 +1,251 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.4
4
+ version: 7.4.0.rc.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.16'
20
20
  type: :runtime
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.16'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: systemu
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.6.4
34
34
  type: :runtime
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: 2.6.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ffi-yajl
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.0'
48
48
  type: :runtime
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: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mixlib-cli
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: :runtime
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: mixlib-config
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '2.0'
76
76
  type: :runtime
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: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mixlib-log
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mixlib-shellout
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.2'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.2'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: ipaddress
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: wmi-lite
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: '1.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: ffi
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ~>
144
144
  - !ruby/object:Gem::Version
145
145
  version: '1.9'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ~>
151
151
  - !ruby/object:Gem::Version
152
152
  version: '1.9'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rake
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ~>
158
158
  - !ruby/object:Gem::Version
159
159
  version: 10.1.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ~>
165
165
  - !ruby/object:Gem::Version
166
166
  version: 10.1.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec-core
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - ~>
172
172
  - !ruby/object:Gem::Version
173
173
  version: '3.0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - "~>"
178
+ - - ~>
179
179
  - !ruby/object:Gem::Version
180
180
  version: '3.0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rspec-expectations
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - "~>"
185
+ - - ~>
186
186
  - !ruby/object:Gem::Version
187
187
  version: '3.0'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - "~>"
192
+ - - ~>
193
193
  - !ruby/object:Gem::Version
194
194
  version: '3.0'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rspec-mocks
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - "~>"
199
+ - - ~>
200
200
  - !ruby/object:Gem::Version
201
201
  version: '3.0'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - "~>"
206
+ - - ~>
207
207
  - !ruby/object:Gem::Version
208
208
  version: '3.0'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: rspec-collection_matchers
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - "~>"
213
+ - - ~>
214
214
  - !ruby/object:Gem::Version
215
215
  version: '1.0'
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - "~>"
220
+ - - ~>
221
221
  - !ruby/object:Gem::Version
222
222
  version: '1.0'
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: rspec_junit_formatter
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
- - - ">="
227
+ - - '>='
228
228
  - !ruby/object:Gem::Version
229
229
  version: '0'
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - ">="
234
+ - - '>='
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: chef
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - ">="
241
+ - - '>='
242
242
  - !ruby/object:Gem::Version
243
243
  version: '0'
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
- - - ">="
248
+ - - '>='
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
251
  description: Ohai profiles your system and emits JSON
@@ -356,6 +356,7 @@ files:
356
356
  - lib/ohai/plugins/perl.rb
357
357
  - lib/ohai/plugins/php.rb
358
358
  - lib/ohai/plugins/platform.rb
359
+ - lib/ohai/plugins/powershell.rb
359
360
  - lib/ohai/plugins/ps.rb
360
361
  - lib/ohai/plugins/python.rb
361
362
  - lib/ohai/plugins/rackspace.rb
@@ -410,6 +411,7 @@ files:
410
411
  - spec/data/plugins/v7message.rb
411
412
  - spec/data/plugins/what.output
412
413
  - spec/data/plugins/xlc.output
414
+ - spec/functional/plugins/powershell_spec.rb
413
415
  - spec/functional/plugins/root_group_spec.rb
414
416
  - spec/ohai_spec.rb
415
417
  - spec/rcov.opts
@@ -490,6 +492,7 @@ files:
490
492
  - spec/unit/plugins/perl_spec.rb
491
493
  - spec/unit/plugins/php_spec.rb
492
494
  - spec/unit/plugins/platform_spec.rb
495
+ - spec/unit/plugins/powershell_spec.rb
493
496
  - spec/unit/plugins/python_spec.rb
494
497
  - spec/unit/plugins/rackspace_spec.rb
495
498
  - spec/unit/plugins/root_group_spec.rb
@@ -516,14 +519,14 @@ require_paths:
516
519
  - lib
517
520
  required_ruby_version: !ruby/object:Gem::Requirement
518
521
  requirements:
519
- - - ">="
522
+ - - '>='
520
523
  - !ruby/object:Gem::Version
521
524
  version: '0'
522
525
  required_rubygems_version: !ruby/object:Gem::Requirement
523
526
  requirements:
524
- - - ">="
527
+ - - '>'
525
528
  - !ruby/object:Gem::Version
526
- version: '0'
529
+ version: 1.3.1
527
530
  requirements: []
528
531
  rubyforge_project:
529
532
  rubygems_version: 2.2.2