ohai 6.18.0 → 6.20.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,42 @@
1
+ #
2
+ # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
+ # Copyright:: Copyright (c) 2013 Opscode, Inc.
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
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
19
+
20
+ describe Ohai::System, "Aix plugin platform" do
21
+ before(:each) do
22
+ @ohai = Ohai::System.new
23
+ @ohai[:kernel] = Mash.new
24
+ @ohai[:kernel][:name] = "aix"
25
+ @ohai[:kernel][:version] = "1"
26
+ @ohai[:kernel][:release] = "0"
27
+ @ohai.stub(:require_plugin).and_return(true)
28
+ @ohai._require_plugin("aix::platform")
29
+ end
30
+
31
+ it "should set platform to aix" do
32
+ @ohai[:platform].should == "aix"
33
+ end
34
+
35
+ it "should set the platform_version" do
36
+ @ohai[:platform_version].should == "1.0"
37
+ end
38
+
39
+ it "should set platform_family" do
40
+ @ohai[:platform_family].should == @ohai[:platform]
41
+ end
42
+ end
@@ -0,0 +1,40 @@
1
+ #
2
+ # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
+ # Copyright:: Copyright (c) 2013 Opscode, Inc.
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
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
19
+
20
+ describe Ohai::System, "Aix plugin uptime" do
21
+
22
+ before(:each) do
23
+ @ohai = Ohai::System.new
24
+ @ohai[:os] = "aix"
25
+ @ohai._require_plugin("uptime")
26
+ @ohai.stub(:popen4).with("who -b").and_yield(nil, StringIO.new, StringIO.new(" . system boot Jul 9 17:51"), nil)
27
+
28
+ Time.stub_chain(:now, :to_i).and_return(1374258600)
29
+ DateTime.stub_chain(:parse, :strftime, :to_i).and_return(1373392260)
30
+ @ohai._require_plugin("aix::uptime")
31
+ end
32
+
33
+ it "should set uptime_seconds to uptime" do
34
+ @ohai[:uptime_seconds].should == 866340
35
+ end
36
+
37
+ it "should set uptime to a human readable date" do
38
+ @ohai[:uptime].should == "10 days 00 hours 39 minutes 00 seconds"
39
+ end
40
+ end
@@ -21,99 +21,55 @@ require 'ohai/mixin/gce_metadata'
21
21
  describe Ohai::System, "plugin gce" do
22
22
  before(:each) do
23
23
  @ohai = Ohai::System.new
24
- @ohai.stub!(:require_plugin).and_return(true)
24
+ @ohai.stub(:require_plugin).and_return(true)
25
25
  end
26
26
 
27
27
  shared_examples_for "!gce" do
28
- it "should NOT attempt to fetch the gce metadata" do
29
- Ohai::Mixin::GCEMetadata.should_not_receive(:http_client)
30
- @ohai._require_plugin("gce")
28
+ it 'should not behave like gce' do
29
+ @ohai[:gce].should be_nil
31
30
  end
32
31
  end
33
32
 
34
33
  shared_examples_for "gce" do
35
34
  before(:each) do
36
- @http_client = mock("Net::HTTP client")
35
+ @http_client = double("Net::HTTP client")
37
36
  Ohai::Mixin::GCEMetadata.stub(:http_client).and_return(@http_client)
38
- IO.stub!(:select).and_return([[],[1],[]])
39
- t = mock("connection")
40
- t.stub!(:connect_nonblock).and_raise(Errno::EINPROGRESS)
41
- Socket.stub!(:new).and_return(t)
42
- Socket.stub!(:pack_sockaddr_in).and_return(nil)
37
+ IO.stub(:select).and_return([[],[1],[]])
38
+ t = double("connection")
39
+ t.stub(:connect_nonblock).and_raise(Errno::EINPROGRESS)
40
+ Socket.stub(:new).and_return(t)
41
+ Socket.stub(:pack_sockaddr_in).and_return(nil)
43
42
  end
44
43
 
45
- it "should recursively fetch metadata" do
46
- @http_client.should_receive(:get).
47
- with("/0.1/meta-data/").
48
- and_return(mock("Net::HTTPOK",
49
- :body => "domain\nhostname\ndescription", :code=>"200"))
50
- @http_client.should_receive(:get).
51
- with("/0.1/meta-data/domain").
52
- and_return(mock("Net::HTTPOK", :body => "test-domain", :code=>"200"))
53
- @http_client.should_receive(:get).
54
- with("/0.1/meta-data/hostname").
55
- and_return(mock("Net::HTTPOK", :body => "test-host", :code=>"200"))
44
+ it "should recursively fetch and properly parse json metadata" do
56
45
  @http_client.should_receive(:get).
57
- with("/0.1/meta-data/description").
58
- and_return(mock("Net::HTTPOK", :body => "test-description", :code=>"200"))
46
+ with("/computeMetadata/v1beta1/?recursive=true/").
47
+ and_return(double("Net::HTTP Response", :body => '{"instance":{"hostname":"test-host"}}', :code=>"200"))
59
48
 
60
49
  @ohai._require_plugin("gce")
61
50
 
62
51
  @ohai[:gce].should_not be_nil
63
- @ohai[:gce]['hostname'].should == "test-host"
64
- @ohai[:gce]['domain'].should == "test-domain"
65
- @ohai[:gce]['description'].should == "test-description"
66
- end
67
-
68
- it "should properly parse json metadata" do
69
- @http_client.should_receive(:get).
70
- with("/0.1/meta-data/").
71
- and_return(mock("Net::HTTP Response", :body => "attached-disks\n", :code=>"200"))
72
- @http_client.should_receive(:get).
73
- with("/0.1/meta-data/attached-disks").
74
- and_return(mock("Net::HTTP Response", :body => '{"disks":[{"deviceName":"boot",
75
- "index":0,"mode":"READ_WRITE","type":"EPHEMERAL"}]}', :code=>"200"))
76
-
77
- @ohai._require_plugin("gce")
78
-
79
- @ohai[:gce].should_not be_nil
80
- @ohai[:gce]['attached_disks'].should eq({"disks"=>[{"deviceName"=>"boot",
81
- "index"=>0,"mode"=>"READ_WRITE",
82
- "type"=>"EPHEMERAL"}]})
52
+ @ohai[:gce]['instance'].should eq("hostname"=>"test-host")
83
53
  end
84
54
  end
85
55
 
86
- describe "with dmi and metadata address connected" do
87
- it_should_behave_like "gce"
88
- before(:each) do
89
- File.should_receive(:read).with('/sys/firmware/dmi/entries/1-0/raw').and_return('Google')
90
- end
91
- end
92
-
93
- describe "without dmi and metadata address connected" do
94
- it_should_behave_like "!gce"
95
- before(:each) do
96
- File.should_receive(:read).with('/sys/firmware/dmi/entries/1-0/raw').and_return('Test')
97
- end
98
- end
99
-
100
56
  describe "with hint file" do
101
57
  it_should_behave_like "gce"
102
58
 
103
59
  before(:each) do
104
- File.stub!(:exist?).with('/etc/chef/ohai/hints/gce.json').and_return(true)
105
- File.stub!(:read).with('/etc/chef/ohai/hints/gce.json').and_return('')
106
- File.stub!(:exist?).with('C:\chef\ohai\hints/gce.json').and_return(true)
107
- File.stub!(:read).with('C:\chef\ohai\hints/gce.json').and_return('')
60
+ File.stub(:exist?).with('/etc/chef/ohai/hints/gce.json').and_return(true)
61
+ File.stub(:read).with('/etc/chef/ohai/hints/gce.json').and_return('')
62
+ File.stub(:exist?).with('C:\chef\ohai\hints/gce.json').and_return(true)
63
+ File.stub(:read).with('C:\chef\ohai\hints/gce.json').and_return('')
108
64
  end
109
65
  end
110
66
 
111
67
  describe "without hint file" do
112
68
  it_should_behave_like "!gce"
113
-
69
+
114
70
  before(:each) do
115
- File.stub!(:exist?).with('/etc/chef/ohai/hints/gce.json').and_return(false)
116
- File.stub!(:exist?).with('C:\chef\ohai\hints/gce.json').and_return(false)
71
+ File.stub(:exist?).with('/etc/chef/ohai/hints/gce.json').and_return(false)
72
+ File.stub(:exist?).with('C:\chef\ohai\hints/gce.json').and_return(false)
117
73
  end
118
74
  end
119
75
 
@@ -121,10 +77,14 @@ describe Ohai::System, "plugin gce" do
121
77
  it_should_behave_like "!gce"
122
78
 
123
79
  before(:each) do
124
- File.stub!(:exist?).with('/etc/chef/ohai/hints/ec2.json').and_return(true)
125
- File.stub!(:read).with('/etc/chef/ohai/hints/ec2.json').and_return('')
126
- File.stub!(:exist?).with('C:\chef\ohai\hints/ec2.json').and_return(true)
127
- File.stub!(:read).with('C:\chef\ohai\hints/ec2.json').and_return('')
80
+ File.stub(:exist?).with('/etc/chef/ohai/hints/gce.json').and_return(false)
81
+ File.stub(:exist?).with('C:\chef\ohai\hints/gce.json').and_return(false)
82
+
83
+ File.stub(:exist?).with('/etc/chef/ohai/hints/ec2.json').and_return(true)
84
+ File.stub(:read).with('/etc/chef/ohai/hints/ec2.json').and_return('')
85
+ File.stub(:exist?).with('C:\chef\ohai\hints/ec2.json').and_return(true)
86
+ File.stub(:read).with('C:\chef\ohai\hints/ec2.json').and_return('')
128
87
  end
129
88
  end
89
+
130
90
  end
@@ -72,12 +72,6 @@ describe Ohai::System, "Linux plugin platform" do
72
72
  @ohai[:platform].should == "linuxmint"
73
73
  @ohai[:platform_family].should == "debian"
74
74
  end
75
- it "should set platform to gcel and platform_family to debian [:lsb][:id] contains GCEL" do
76
- @ohai[:lsb][:id] = "GCEL"
77
- @ohai._require_plugin("linux::platform")
78
- @ohai[:platform].should == "gcel"
79
- @ohai[:platform_family].should == "debian"
80
- end
81
75
  it "should set platform to debian and platform_family to debian [:lsb][:id] contains Debian" do
82
76
  @ohai[:lsb][:id] = "Debian"
83
77
  @ohai._require_plugin("linux::platform")
metadata CHANGED
@@ -1,32 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.18.0
4
+ version: 6.20.0.rc.1
5
+ prerelease: 7
5
6
  platform: ruby
6
7
  authors:
7
8
  - Adam Jacob
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-07-19 00:00:00.000000000 Z
12
+ date: 2013-10-24 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: systemu
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ! '>='
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
- version: '0'
21
+ version: 2.5.2
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - ! '>='
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: 2.5.2
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: yajl-ruby
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: mixlib-cli
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: mixlib-config
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ! '>='
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: mixlib-log
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ! '>='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ! '>='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: mixlib-shellout
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ! '>='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ! '>='
95
108
  - !ruby/object:Gem::Version
@@ -97,6 +110,7 @@ dependencies:
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: ipaddress
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ! '>='
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - ! '>='
109
124
  - !ruby/object:Gem::Version
@@ -111,6 +126,7 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: rake
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
131
  - - ! '>='
116
132
  - !ruby/object:Gem::Version
@@ -118,6 +134,7 @@ dependencies:
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
139
  - - ! '>='
123
140
  - !ruby/object:Gem::Version
@@ -125,6 +142,7 @@ dependencies:
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: rspec-core
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
147
  - - ! '>='
130
148
  - !ruby/object:Gem::Version
@@ -132,6 +150,7 @@ dependencies:
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
155
  - - ! '>='
137
156
  - !ruby/object:Gem::Version
@@ -139,6 +158,7 @@ dependencies:
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: rspec-expectations
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
163
  - - ! '>='
144
164
  - !ruby/object:Gem::Version
@@ -146,6 +166,7 @@ dependencies:
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
171
  - - ! '>='
151
172
  - !ruby/object:Gem::Version
@@ -153,6 +174,7 @@ dependencies:
153
174
  - !ruby/object:Gem::Dependency
154
175
  name: rspec-mocks
155
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
156
178
  requirements:
157
179
  - - ! '>='
158
180
  - !ruby/object:Gem::Version
@@ -160,6 +182,7 @@ dependencies:
160
182
  type: :development
161
183
  prerelease: false
162
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
163
186
  requirements:
164
187
  - - ! '>='
165
188
  - !ruby/object:Gem::Version
@@ -167,6 +190,7 @@ dependencies:
167
190
  - !ruby/object:Gem::Dependency
168
191
  name: rspec_junit_formatter
169
192
  requirement: !ruby/object:Gem::Requirement
193
+ none: false
170
194
  requirements:
171
195
  - - ! '>='
172
196
  - !ruby/object:Gem::Version
@@ -174,6 +198,7 @@ dependencies:
174
198
  type: :development
175
199
  prerelease: false
176
200
  version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
177
202
  requirements:
178
203
  - - ! '>='
179
204
  - !ruby/object:Gem::Version
@@ -202,6 +227,7 @@ files:
202
227
  - lib/ohai/plugins/aix/cpu.rb
203
228
  - lib/ohai/plugins/aix/filesystem.rb
204
229
  - lib/ohai/plugins/aix/hostname.rb
230
+ - lib/ohai/plugins/aix/kernel.rb
205
231
  - lib/ohai/plugins/aix/memory.rb
206
232
  - lib/ohai/plugins/aix/network.rb
207
233
  - lib/ohai/plugins/aix/platform.rb
@@ -343,6 +369,13 @@ files:
343
369
  - spec/unit/mixin/command_spec.rb
344
370
  - spec/unit/mixin/ec2_metadata_spec.rb
345
371
  - spec/unit/mixin/from_file_spec.rb
372
+ - spec/unit/plugins/aix/cpu_spec.rb
373
+ - spec/unit/plugins/aix/filesystem_spec.rb
374
+ - spec/unit/plugins/aix/hostname_spec.rb
375
+ - spec/unit/plugins/aix/kernel_spec.rb
376
+ - spec/unit/plugins/aix/network_spec.rb
377
+ - spec/unit/plugins/aix/platform_spec.rb
378
+ - spec/unit/plugins/aix/uptime_spec.rb
346
379
  - spec/unit/plugins/azure_spec.rb
347
380
  - spec/unit/plugins/c_spec.rb
348
381
  - spec/unit/plugins/chef_spec.rb
@@ -410,25 +443,26 @@ files:
410
443
  - bin/ohai
411
444
  homepage: http://wiki.opscode.com/display/chef/Ohai
412
445
  licenses: []
413
- metadata: {}
414
446
  post_install_message:
415
447
  rdoc_options: []
416
448
  require_paths:
417
449
  - lib
418
450
  required_ruby_version: !ruby/object:Gem::Requirement
451
+ none: false
419
452
  requirements:
420
453
  - - ! '>='
421
454
  - !ruby/object:Gem::Version
422
455
  version: '0'
423
456
  required_rubygems_version: !ruby/object:Gem::Requirement
457
+ none: false
424
458
  requirements:
425
- - - ! '>='
459
+ - - ! '>'
426
460
  - !ruby/object:Gem::Version
427
- version: '0'
461
+ version: 1.3.1
428
462
  requirements: []
429
463
  rubyforge_project:
430
- rubygems_version: 2.0.3
464
+ rubygems_version: 1.8.23
431
465
  signing_key:
432
- specification_version: 4
466
+ specification_version: 3
433
467
  summary: Ohai profiles your system and emits JSON
434
468
  test_files: []