ohai 14.5.4 → 14.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ohai/application.rb +19 -0
- data/lib/ohai/exception.rb +1 -0
- data/lib/ohai/hints.rb +5 -0
- data/lib/ohai/log.rb +2 -0
- data/lib/ohai/plugins/cpu.rb +416 -0
- data/lib/ohai/plugins/darwin/hardware.rb +1 -7
- data/lib/ohai/plugins/darwin/system_profiler.rb +19 -19
- data/lib/ohai/plugins/filesystem.rb +326 -115
- data/lib/ohai/plugins/linux/platform.rb +1 -1
- data/lib/ohai/plugins/os.rb +16 -0
- data/lib/ohai/system.rb +12 -2
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +23 -1
- data/spec/unit/plugins/darwin/cpu_spec.rb +3 -3
- data/spec/unit/plugins/freebsd/cpu_spec.rb +2 -2
- data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
- data/spec/unit/plugins/linux/platform_spec.rb +2 -1
- data/spec/unit/plugins/os_spec.rb +33 -0
- data/spec/unit/plugins/solaris2/cpu_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/filesystem.rb +355 -32
- data/spec/unit/plugins/windows/cpu_spec.rb +1 -1
- metadata +3 -18
- data/lib/ohai/plugins/aix/cpu.rb +0 -64
- data/lib/ohai/plugins/aix/filesystem.rb +0 -90
- data/lib/ohai/plugins/aix/os.rb +0 -30
- data/lib/ohai/plugins/darwin/cpu.rb +0 -50
- data/lib/ohai/plugins/dragonflybsd/cpu.rb +0 -58
- data/lib/ohai/plugins/dragonflybsd/os.rb +0 -31
- data/lib/ohai/plugins/freebsd/cpu.rb +0 -70
- data/lib/ohai/plugins/freebsd/os.rb +0 -32
- data/lib/ohai/plugins/linux/cpu.rb +0 -120
- data/lib/ohai/plugins/netbsd/cpu.rb +0 -50
- data/lib/ohai/plugins/openbsd/cpu.rb +0 -43
- data/lib/ohai/plugins/solaris2/cpu.rb +0 -70
- data/lib/ohai/plugins/solaris2/filesystem.rb +0 -106
- data/lib/ohai/plugins/windows/cpu.rb +0 -59
- data/spec/unit/plugins/aix/os_spec.rb +0 -35
- data/spec/unit/plugins/freebsd/os_spec.rb +0 -32
@@ -1,59 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Doug MacEachern <dougm@vmware.com>
|
3
|
-
# Copyright:: Copyright (c) 2010 VMware, 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
|
-
|
19
|
-
Ohai.plugin(:CPU) do
|
20
|
-
provides "cpu"
|
21
|
-
|
22
|
-
collect_data(:windows) do
|
23
|
-
require "wmi-lite/wmi"
|
24
|
-
|
25
|
-
cpu Mash.new
|
26
|
-
cores = 0
|
27
|
-
logical_processors = 0
|
28
|
-
|
29
|
-
wmi = WmiLite::Wmi.new
|
30
|
-
processors = wmi.instances_of("Win32_Processor")
|
31
|
-
|
32
|
-
processors.each_with_index do |processor, index|
|
33
|
-
current_cpu = index.to_s
|
34
|
-
cpu[current_cpu] = Mash.new
|
35
|
-
|
36
|
-
cpu[current_cpu]["cores"] = processor["numberofcores"]
|
37
|
-
cores += processor["numberofcores"]
|
38
|
-
|
39
|
-
logical_processors += processor["numberoflogicalprocessors"]
|
40
|
-
cpu[current_cpu]["vendor_id"] = processor["manufacturer"]
|
41
|
-
cpu[current_cpu]["family"] = processor["family"].to_s
|
42
|
-
cpu[current_cpu]["model"] = processor["revision"].to_s
|
43
|
-
cpu[current_cpu]["stepping"] = if processor["stepping"].nil?
|
44
|
-
processor["description"].match(/Stepping\s+(\d+)/)[1]
|
45
|
-
else
|
46
|
-
processor["stepping"]
|
47
|
-
end
|
48
|
-
cpu[current_cpu]["physical_id"] = processor["deviceid"]
|
49
|
-
cpu[current_cpu]["model_name"] = processor["name"]
|
50
|
-
cpu[current_cpu]["description"] = processor["description"]
|
51
|
-
cpu[current_cpu]["mhz"] = processor["maxclockspeed"].to_s
|
52
|
-
cpu[current_cpu]["cache_size"] = "#{processor['l2cachesize']} KB"
|
53
|
-
end
|
54
|
-
|
55
|
-
cpu[:total] = logical_processors
|
56
|
-
cpu[:cores] = cores
|
57
|
-
cpu[:real] = processors.length
|
58
|
-
end
|
59
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Isa Farnik (<isa@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) 2013-2016 Chef Software, 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_relative "../../../spec_helper.rb"
|
19
|
-
|
20
|
-
describe Ohai::System, "AIX os plugin" do
|
21
|
-
before(:each) do
|
22
|
-
@plugin = get_plugin("aix/os")
|
23
|
-
allow(@plugin).to receive(:collect_os).and_return(:aix)
|
24
|
-
allow(@plugin).to receive(:shell_out).with("oslevel -s").and_return(mock_shell_out(0, "7200-00-01-1543\n", nil))
|
25
|
-
@plugin.run
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should set the top-level os attribute" do
|
29
|
-
expect(@plugin[:os]).to eql(:aix)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should set the top-level os_level attribute" do
|
33
|
-
expect(@plugin[:os_version]).to eql("7200-00-01-1543")
|
34
|
-
end
|
35
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Richard Manyanza (<liseki@nyikacraftsmen.com>)
|
3
|
-
# Copyright:: Copyright (c) 2014 Richard Manyanza.
|
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_relative "../../../spec_helper.rb"
|
20
|
-
|
21
|
-
describe Ohai::System, "FreeBSD plugin os" do
|
22
|
-
before(:each) do
|
23
|
-
@plugin = get_plugin("freebsd/os")
|
24
|
-
allow(@plugin).to receive(:shell_out).with("sysctl -n kern.osreldate").and_return(mock_shell_out(0, "902001\n", ""))
|
25
|
-
allow(@plugin).to receive(:collect_os).and_return(:freebsd)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should set os_version to __FreeBSD_version" do
|
29
|
-
@plugin.run
|
30
|
-
expect(@plugin[:os_version]).to eq("902001")
|
31
|
-
end
|
32
|
-
end
|