ohai 8.8.1 → 8.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +6 -0
- data/bin/ohai +2 -2
- data/lib/ohai.rb +4 -4
- data/lib/ohai/config.rb +2 -2
- data/lib/ohai/dsl.rb +2 -2
- data/lib/ohai/dsl/plugin.rb +3 -3
- data/lib/ohai/dsl/plugin/versionvi.rb +3 -3
- data/lib/ohai/dsl/plugin/versionvii.rb +2 -2
- data/lib/ohai/exception.rb +2 -2
- data/lib/ohai/hints.rb +2 -2
- data/lib/ohai/loader.rb +1 -1
- data/lib/ohai/log.rb +2 -2
- data/lib/ohai/mixin/command.rb +2 -2
- data/lib/ohai/mixin/constant_helper.rb +2 -2
- data/lib/ohai/mixin/dmi_decode.rb +1 -1
- data/lib/ohai/mixin/ec2_metadata.rb +3 -3
- data/lib/ohai/mixin/network_constants.rb +4 -4
- data/lib/ohai/mixin/os.rb +2 -2
- data/lib/ohai/mixin/seconds_to_human.rb +4 -4
- data/lib/ohai/mixin/string.rb +4 -4
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/cpu.rb +35 -29
- data/lib/ohai/plugins/aix/filesystem.rb +58 -40
- data/lib/ohai/plugins/aix/kernel.rb +3 -2
- data/lib/ohai/plugins/aix/memory.rb +4 -3
- data/lib/ohai/plugins/aix/network.rb +6 -4
- data/lib/ohai/plugins/aix/os.rb +30 -0
- data/lib/ohai/plugins/aix/platform.rb +3 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -2
- data/lib/ohai/plugins/aix/virtualization.rb +115 -5
- data/lib/ohai/plugins/azure.rb +1 -1
- data/lib/ohai/plugins/bsd/filesystem.rb +1 -1
- data/lib/ohai/plugins/command.rb +4 -4
- data/lib/ohai/plugins/darwin/cpu.rb +5 -3
- data/lib/ohai/plugins/darwin/filesystem.rb +4 -4
- data/lib/ohai/plugins/darwin/filesystem2.rb +4 -4
- data/lib/ohai/plugins/darwin/memory.rb +6 -5
- data/lib/ohai/plugins/darwin/network.rb +2 -2
- data/lib/ohai/plugins/darwin/platform.rb +2 -2
- data/lib/ohai/plugins/darwin/system_profiler.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/os.rb +2 -2
- data/lib/ohai/plugins/ec2.rb +3 -3
- data/lib/ohai/plugins/erlang.rb +3 -3
- data/lib/ohai/plugins/eucalyptus.rb +3 -3
- data/lib/ohai/plugins/freebsd/cpu.rb +8 -4
- data/lib/ohai/plugins/freebsd/os.rb +2 -2
- data/lib/ohai/plugins/hostname.rb +12 -4
- data/lib/ohai/plugins/init_package.rb +2 -8
- data/lib/ohai/plugins/java.rb +2 -2
- data/lib/ohai/plugins/kernel.rb +5 -4
- data/lib/ohai/plugins/keys.rb +3 -3
- data/lib/ohai/plugins/languages.rb +4 -4
- data/lib/ohai/plugins/linux/block_device.rb +3 -3
- data/lib/ohai/plugins/linux/cpu.rb +2 -2
- data/lib/ohai/plugins/linux/filesystem.rb +2 -2
- data/lib/ohai/plugins/linux/filesystem2.rb +3 -3
- data/lib/ohai/plugins/linux/lsb.rb +2 -2
- data/lib/ohai/plugins/linux/memory.rb +2 -2
- data/lib/ohai/plugins/linux/network.rb +141 -59
- data/lib/ohai/plugins/linux/platform.rb +6 -1
- data/lib/ohai/plugins/linux/virtualization.rb +1 -1
- data/lib/ohai/plugins/network.rb +49 -42
- data/lib/ohai/plugins/ohai_time.rb +4 -4
- data/lib/ohai/plugins/openstack.rb +2 -2
- data/lib/ohai/plugins/os.rb +2 -2
- data/lib/ohai/plugins/packages.rb +122 -0
- data/lib/ohai/plugins/perl.rb +5 -5
- data/lib/ohai/plugins/platform.rb +2 -2
- data/lib/ohai/plugins/powershell.rb +2 -2
- data/lib/ohai/plugins/ps.rb +2 -2
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +13 -0
- data/lib/ohai/plugins/ruby.rb +6 -6
- data/lib/ohai/plugins/sigar/network_route.rb +1 -1
- data/lib/ohai/plugins/solaris2/filesystem.rb +1 -1
- data/lib/ohai/plugins/solaris2/network.rb +1 -1
- data/lib/ohai/plugins/solaris2/platform.rb +1 -1
- data/lib/ohai/plugins/solaris2/virtualization.rb +5 -5
- data/lib/ohai/plugins/solaris2/zpools.rb +2 -2
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +4 -4
- data/lib/ohai/plugins/virtualbox.rb +1 -1
- data/lib/ohai/plugins/virtualization.rb +7 -7
- data/lib/ohai/plugins/vmware.rb +1 -1
- data/lib/ohai/plugins/windows/filesystem.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +1 -1
- data/lib/ohai/plugins/windows/platform.rb +1 -1
- data/lib/ohai/plugins/windows/virtualization.rb +1 -1
- data/lib/ohai/provides_map.rb +3 -3
- data/lib/ohai/runner.rb +2 -2
- data/lib/ohai/system.rb +2 -2
- data/lib/ohai/util/file_helper.rb +1 -1
- data/lib/ohai/util/win32.rb +1 -1
- data/lib/ohai/util/win32/group_helper.rb +1 -1
- data/lib/ohai/version.rb +3 -3
- data/spec/data/plugins/dpkg-query.output +1087 -0
- data/spec/data/plugins/lslpp.output +49 -0
- data/spec/data/plugins/pkginfo.output +50 -0
- data/spec/data/plugins/pkglist.output +24 -0
- data/spec/data/plugins/rpmquery.output +388 -0
- data/spec/functional/application_spec.rb +1 -1
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +1 -1
- data/spec/functional/plugins/root_group_spec.rb +2 -2
- data/spec/ohai_spec.rb +6 -6
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/dsl/plugin_spec.rb +2 -2
- data/spec/unit/hints_spec.rb +2 -2
- data/spec/unit/loader_spec.rb +2 -2
- data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +1 -1
- data/spec/unit/plugins/aix/cpu_spec.rb +68 -40
- data/spec/unit/plugins/aix/filesystem_spec.rb +152 -50
- data/spec/unit/plugins/aix/hostname_spec.rb +5 -3
- data/spec/unit/plugins/aix/kernel_spec.rb +2 -1
- data/spec/unit/plugins/aix/memory_spec.rb +7 -5
- data/spec/unit/plugins/aix/network_spec.rb +17 -1
- data/spec/unit/plugins/aix/os_spec.rb +35 -0
- data/spec/unit/plugins/aix/platform_spec.rb +5 -4
- data/spec/unit/plugins/aix/uptime_spec.rb +2 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +269 -3
- data/spec/unit/plugins/azure_spec.rb +1 -1
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +2 -2
- data/spec/unit/plugins/chef_spec.rb +8 -8
- data/spec/unit/plugins/darwin/cpu_spec.rb +8 -3
- data/spec/unit/plugins/darwin/hostname_spec.rb +2 -2
- data/spec/unit/plugins/darwin/kernel_spec.rb +4 -4
- data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
- data/spec/unit/plugins/darwin/network_spec.rb +1 -1
- data/spec/unit/plugins/darwin/platform_spec.rb +6 -6
- data/spec/unit/plugins/darwin/system_profiler_output.rb +0 -1
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +4 -4
- data/spec/unit/plugins/ec2_spec.rb +3 -3
- data/spec/unit/plugins/erlang_spec.rb +3 -3
- data/spec/unit/plugins/eucalyptus_spec.rb +2 -2
- data/spec/unit/plugins/fail_spec.rb +6 -6
- data/spec/unit/plugins/freebsd/cpu_spec.rb +19 -4
- data/spec/unit/plugins/freebsd/hostname_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/kernel_spec.rb +4 -4
- data/spec/unit/plugins/freebsd/platform_spec.rb +7 -7
- data/spec/unit/plugins/hostname_spec.rb +2 -2
- data/spec/unit/plugins/init_package_spec.rb +12 -2
- data/spec/unit/plugins/java_spec.rb +5 -5
- data/spec/unit/plugins/kernel_spec.rb +4 -2
- data/spec/unit/plugins/linux/block_device_spec.rb +75 -0
- data/spec/unit/plugins/linux/cpu_spec.rb +2 -2
- data/spec/unit/plugins/linux/filesystem2_spec.rb +14 -14
- data/spec/unit/plugins/linux/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostname_spec.rb +2 -2
- data/spec/unit/plugins/linux/kernel_spec.rb +5 -5
- data/spec/unit/plugins/linux/lsb_spec.rb +17 -17
- data/spec/unit/plugins/linux/network_spec.rb +80 -11
- data/spec/unit/plugins/linux/platform_spec.rb +20 -1
- data/spec/unit/plugins/linux/uptime_spec.rb +8 -8
- data/spec/unit/plugins/linux/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/lua_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +2 -2
- data/spec/unit/plugins/network_spec.rb +110 -37
- data/spec/unit/plugins/nodejs_spec.rb +2 -2
- data/spec/unit/plugins/ohai_spec.rb +5 -5
- data/spec/unit/plugins/ohai_time_spec.rb +8 -8
- data/spec/unit/plugins/openbsd/hostname_spec.rb +2 -2
- data/spec/unit/plugins/openbsd/kernel_spec.rb +4 -4
- data/spec/unit/plugins/openbsd/platform_spec.rb +6 -6
- data/spec/unit/plugins/openstack_spec.rb +2 -2
- data/spec/unit/plugins/os_spec.rb +11 -11
- data/spec/unit/plugins/packages_spec.rb +241 -0
- data/spec/unit/plugins/perl_spec.rb +3 -3
- data/spec/unit/plugins/php_spec.rb +2 -2
- data/spec/unit/plugins/platform_spec.rb +2 -2
- data/spec/unit/plugins/python_spec.rb +3 -3
- data/spec/unit/plugins/rackspace_spec.rb +7 -0
- data/spec/unit/plugins/ruby_spec.rb +3 -3
- data/spec/unit/plugins/sigar/network_route_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/cpu_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/filesystem.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/platform_spec.rb +5 -5
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/ssh_host_keys_spec.rb +2 -2
- data/spec/unit/plugins/virtualbox_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
- data/spec/unit/provides_map_spec.rb +2 -2
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/system_spec.rb +3 -3
- data/spec/unit/util/file_helper_spec.rb +1 -1
- metadata +13 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Claire McQuin <claire@chef.io>
|
3
|
-
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
3
|
+
# Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Edwards (<adamed@
|
2
|
+
# Author:: Adam Edwards (<adamed@chef.io>)
|
3
3
|
#
|
4
|
-
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
4
|
+
# Copyright:: Copyright (c) 2014-2016 Chef Software, Inc.
|
5
5
|
#
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
data/spec/ohai_spec.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Copyright:: Copyright (c) 2008
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -19,9 +19,9 @@
|
|
19
19
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper.rb')
|
20
20
|
|
21
21
|
describe Ohai do
|
22
|
-
|
22
|
+
|
23
23
|
it "should have a version constant defined" do
|
24
24
|
expect(Ohai::VERSION).to be_a_kind_of(String)
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Claire McQuin <claire@chef.io>
|
3
|
-
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
3
|
+
# Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/spec/unit/config_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Claire McQuin (<claire@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
3
|
+
# Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Claire McQuin (<claire@
|
3
|
-
# Copyright:: Copyright (c) 2013
|
2
|
+
# Author:: Claire McQuin (<claire@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
data/spec/unit/hints_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Serdar Sutay (<serdar@
|
3
|
-
# Copyright:: Copyright (c) 2013
|
2
|
+
# Author:: Serdar Sutay (<serdar@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/spec/unit/loader_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Claire McQuin (<claire@
|
3
|
-
# Copyright:: Copyright (c) 2013
|
2
|
+
# Author:: Claire McQuin (<claire@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Bryan McLellan <btm@loftninjas.org>
|
3
|
-
# Copyright:: Copyright (c) 2013
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
#
|
3
|
+
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -38,62 +39,89 @@ CPU 1 runs at 1654 MHz
|
|
38
39
|
CPU 2 runs at 1654 MHz
|
39
40
|
CPU 3 runs at 1654 MHz
|
40
41
|
PMCYCLES_M
|
41
|
-
|
42
|
+
|
42
43
|
@plugin = get_plugin("aix/cpu")
|
43
44
|
allow(@plugin).to receive(:collect_os).and_return(:aix)
|
44
45
|
|
45
46
|
allow(@plugin).to receive(:shell_out).with("lsdev -Cc processor").and_return(mock_shell_out(0, @lsdev_Cc_processor, nil))
|
46
47
|
allow(@plugin).to receive(:shell_out).with("lsattr -El proc0").and_return(mock_shell_out(0, @lsattr_El_proc0, nil))
|
47
48
|
allow(@plugin).to receive(:shell_out).with("pmcycles -m").and_return(mock_shell_out(0, @pmcycles_m, nil))
|
48
|
-
@plugin.run
|
49
49
|
end
|
50
50
|
|
51
|
+
context "when run on an LPAR" do
|
52
|
+
before do
|
53
|
+
allow(@plugin).to receive(:shell_out).with("uname -W").and_return(mock_shell_out(0, "0", nil))
|
54
|
+
@plugin.run
|
55
|
+
end
|
51
56
|
|
52
|
-
|
53
|
-
|
54
|
-
|
57
|
+
it "sets the vendor id to IBM" do
|
58
|
+
expect(@plugin[:cpu]["0"][:vendor_id]).to eq("IBM")
|
59
|
+
end
|
55
60
|
|
56
|
-
|
57
|
-
|
58
|
-
|
61
|
+
it "sets the available attribute" do
|
62
|
+
expect(@plugin[:cpu][:available]).to eq(1)
|
63
|
+
end
|
59
64
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
it "sets the real number of processors" do
|
65
|
-
expect(@plugin[:cpu][:real]).to eq(2)
|
66
|
-
end
|
67
|
-
|
68
|
-
it "sets the number of cores" do
|
69
|
-
#from http://www-01.ibm.com/software/passportadvantage/pvu_terminology_for_customers.html
|
70
|
-
#on AIX number of cores and processors are considered same
|
71
|
-
expect(@plugin[:cpu][:cores]).to eq(@plugin[:cpu][:real])
|
72
|
-
end
|
65
|
+
it "sets the total number of processors" do
|
66
|
+
expect(@plugin[:cpu][:total]).to eq(4)
|
67
|
+
end
|
73
68
|
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
it "sets the real number of processors" do
|
70
|
+
expect(@plugin[:cpu][:real]).to eq(2)
|
71
|
+
end
|
77
72
|
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
it "sets the number of cores" do
|
74
|
+
#from http://www-01.ibm.com/software/passportadvantage/pvu_terminology_for_customers.html
|
75
|
+
#on AIX number of cores and processors are considered same
|
76
|
+
expect(@plugin[:cpu][:cores]).to eq(@plugin[:cpu][:real])
|
77
|
+
end
|
81
78
|
|
82
|
-
|
83
|
-
|
84
|
-
|
79
|
+
it "detects the model" do
|
80
|
+
expect(@plugin[:cpu]["0"][:model_name]).to eq("PowerPC_POWER5")
|
81
|
+
end
|
85
82
|
|
86
|
-
|
87
|
-
|
83
|
+
it "detects the mhz" do
|
84
|
+
expect(@plugin[:cpu]["0"][:mhz]).to eq(1654)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "detects the status of the device" do
|
88
|
+
expect(@plugin[:cpu]["0"][:status]).to eq("Available")
|
89
|
+
end
|
90
|
+
|
91
|
+
it "detects the location of the device" do
|
92
|
+
expect(@plugin[:cpu]["0"][:location]).to eq("00-00")
|
93
|
+
end
|
94
|
+
|
95
|
+
context "lsattr -El device_name" do
|
96
|
+
it "detects all the attributes of the device" do
|
97
|
+
expect(@plugin[:cpu]["0"][:mhz]).to eq(1654)
|
98
|
+
expect(@plugin[:cpu]["0"][:smt_enabled]).to eq("true")
|
99
|
+
expect(@plugin[:cpu]["0"][:smt_threads]).to eq("2")
|
100
|
+
expect(@plugin[:cpu]["0"][:state]).to eq("enable")
|
101
|
+
expect(@plugin[:cpu]["0"][:model_name]).to eq("PowerPC_POWER5")
|
102
|
+
end
|
103
|
+
end
|
88
104
|
end
|
89
105
|
|
90
|
-
context "
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
106
|
+
context "when run on a WPAR" do
|
107
|
+
before do
|
108
|
+
allow(@plugin).to receive(:shell_out).with("uname -W").and_return(mock_shell_out(0, "120", nil))
|
109
|
+
@plugin.run
|
110
|
+
end
|
111
|
+
|
112
|
+
it "sets the total number of processors" do
|
113
|
+
expect(@plugin[:cpu][:total]).to eq(4)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "doesn't set the real number of CPUs" do
|
117
|
+
expect(@plugin[:cpu][:real]).to be_nil
|
118
|
+
end
|
119
|
+
|
120
|
+
it "doesn't set mhz of a processor it can't see" do
|
121
|
+
# I'm so sorry
|
122
|
+
expect {
|
123
|
+
expect(@plugin[:cpu]["0"][:mhz]).to eq(1654)
|
124
|
+
}.to raise_error(NoMethodError)
|
97
125
|
end
|
98
126
|
end
|
99
127
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
#
|
3
|
+
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
+
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -18,20 +19,45 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
|
|
18
19
|
|
19
20
|
describe Ohai::System, "AIX filesystem plugin" do
|
20
21
|
before(:each) do
|
21
|
-
@
|
22
|
-
Filesystem
|
23
|
-
/dev/hd4
|
24
|
-
/dev/hd2
|
25
|
-
/dev/hd9var
|
26
|
-
/dev/hd3
|
27
|
-
/dev/hd1
|
28
|
-
/dev/hd11admin
|
29
|
-
/proc
|
30
|
-
/dev/hd10opt
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
22
|
+
@df_Pk_LPAR = <<-DF_PK
|
23
|
+
Filesystem 1024-blocks Used Available Capacity Mounted on
|
24
|
+
/dev/hd4 2097152 219796 1877356 11% /
|
25
|
+
/dev/hd2 5242880 2416828 2826052 47% /usr
|
26
|
+
/dev/hd9var 5242880 395540 4847340 8% /var
|
27
|
+
/dev/hd3 5242880 1539508 3703372 30% /tmp
|
28
|
+
/dev/hd1 10485760 1972 10483788 1% /home
|
29
|
+
/dev/hd11admin 131072 380 130692 1% /admin
|
30
|
+
/proc - - - - /proc
|
31
|
+
/dev/hd10opt 5242880 1286720 3956160 25% /opt
|
32
|
+
/dev/livedump 262144 368 261776 1% /var/adm/ras/livedump
|
33
|
+
/dev/fslv00 524288 45076 479212 9% /wpars/sink-thinker-541ba3
|
34
|
+
/dev/fslv01 2097152 8956 2088196 1% /wpars/sink-thinker-541ba3/home
|
35
|
+
/dev/fslv02 5242880 1307352 3935528 25% /wpars/sink-thinker-541ba3/opt
|
36
|
+
/proc - - - - /wpars/sink-thinker-541ba3/proc
|
37
|
+
/dev/fslv03 1048576 168840 879736 17% /wpars/sink-thinker-541ba3/tmp
|
38
|
+
/dev/fslv04 5242880 2725040 2517840 52% /wpars/sink-thinker-541ba3/usr
|
39
|
+
/dev/fslv05 524288 76000 448288 15% /wpars/sink-thinker-541ba3/var
|
40
|
+
/dev/fslv07 10485760 130872 10354888 2% /wpars/toolchain-tester-5c969f
|
41
|
+
/dev/fslv08 5242880 39572 5203308 1% /wpars/toolchain-tester-5c969f/home
|
42
|
+
/dev/fslv09 5242880 1477164 3765716 29% /wpars/toolchain-tester-5c969f/opt
|
43
|
+
/proc - - - - /wpars/toolchain-tester-5c969f/proc
|
44
|
+
/dev/fslv10 5242880 42884 5199996 1% /wpars/toolchain-tester-5c969f/tmp
|
45
|
+
/dev/fslv11 5242880 2725048 2517832 52% /wpars/toolchain-tester-5c969f/usr
|
46
|
+
/dev/fslv12 10485760 272376 10213384 3% /wpars/toolchain-tester-5c969f/var
|
47
|
+
DF_PK
|
48
|
+
|
49
|
+
@df_Pk_WPAR = <<-DF_PK
|
50
|
+
Filesystem 1024-blocks Used Available Capacity Mounted on
|
51
|
+
Global 10485760 130872 10354888 2% /
|
52
|
+
Global 5242880 39572 5203308 1% /home
|
53
|
+
Global 5242880 1477164 3765716 29% /opt
|
54
|
+
Global - - - - /proc
|
55
|
+
Global 5242880 42884 5199996 1% /tmp
|
56
|
+
Global 5242880 2725048 2517832 52% /usr
|
57
|
+
Global 10485760 272376 10213384 3% /var
|
58
|
+
DF_PK
|
59
|
+
|
60
|
+
@mount_LPAR = <<-MOUNT
|
35
61
|
node mounted mounted over vfs date options
|
36
62
|
-------- --------------- --------------- ------ ------------ ---------------
|
37
63
|
/dev/hd4 / jfs2 Jul 17 13:22 rw,log=/dev/hd8
|
@@ -43,70 +69,146 @@ DF_P
|
|
43
69
|
/proc /proc procfs Jul 17 13:22 rw
|
44
70
|
/dev/hd10opt /opt jfs2 Jul 17 13:22 rw,log=/dev/hd8
|
45
71
|
192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
72
|
+
MOUNT
|
73
|
+
|
74
|
+
@mount_WPAR = <<-MOUNT
|
75
|
+
node mounted mounted over vfs date options
|
76
|
+
-------- --------------- --------------- ------ ------------ ---------------
|
77
|
+
Global / jfs2 Nov 23 21:03 rw,log=NULL
|
78
|
+
Global /home jfs2 Nov 23 21:03 rw,log=NULL
|
79
|
+
Global /opt jfs2 Nov 23 21:03 rw,log=NULL
|
80
|
+
Global /proc namefs Nov 23 21:03 rw
|
81
|
+
Global /tmp jfs2 Nov 23 21:03 rw,log=NULL
|
82
|
+
Global /usr jfs2 Nov 23 21:03 rw,log=NULL
|
83
|
+
Global /var jfs2 Nov 23 21:03 rw,log=NULL
|
84
|
+
192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
46
85
|
MOUNT
|
47
86
|
|
48
87
|
@plugin = get_plugin("aix/filesystem")
|
49
88
|
allow(@plugin).to receive(:collect_os).and_return(:aix)
|
50
89
|
@plugin[:filesystem] = Mash.new
|
51
|
-
allow(@plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, @df_P, nil))
|
52
|
-
allow(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @mount, nil))
|
53
|
-
|
54
|
-
@plugin.run
|
55
90
|
end
|
56
91
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
92
|
+
context 'when run within an LPAR' do
|
93
|
+
before do
|
94
|
+
allow(@plugin).to receive(:shell_out).with("df -Pk").and_return(mock_shell_out(0, @df_Pk_LPAR, nil))
|
95
|
+
allow(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @mount_LPAR, nil))
|
96
|
+
@plugin.run
|
61
97
|
end
|
62
98
|
|
63
|
-
|
64
|
-
expect(@plugin[:filesystem]["/dev/hd4"]['kb_used']).to eq("495632")
|
65
|
-
end
|
99
|
+
describe "df -Pk" do
|
66
100
|
|
67
|
-
|
68
|
-
|
69
|
-
|
101
|
+
it "returns the filesystem block size" do
|
102
|
+
expect(@plugin[:filesystem]["/dev/hd4"]['kb_size']).to eq("2097152")
|
103
|
+
end
|
70
104
|
|
71
|
-
|
72
|
-
|
73
|
-
|
105
|
+
it "returns the filesystem used space in kb" do
|
106
|
+
expect(@plugin[:filesystem]["/dev/hd4"]['kb_used']).to eq("219796")
|
107
|
+
end
|
74
108
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
109
|
+
it "returns the filesystem available space in kb" do
|
110
|
+
expect(@plugin[:filesystem]["/dev/hd4"]['kb_available']).to eq("1877356")
|
111
|
+
end
|
79
112
|
|
80
|
-
|
113
|
+
it "returns the filesystem capacity in percentage" do
|
114
|
+
expect(@plugin[:filesystem]["/dev/hd4"]['percent_used']).to eq("11%")
|
115
|
+
end
|
81
116
|
|
82
|
-
|
83
|
-
|
117
|
+
it "returns the filesystem mounted location" do
|
118
|
+
expect(@plugin[:filesystem]["/dev/hd4"]['mount']).to eq("/")
|
119
|
+
end
|
84
120
|
end
|
85
121
|
|
86
|
-
|
87
|
-
|
122
|
+
describe "mount" do
|
123
|
+
|
124
|
+
it "returns the filesystem mount location" do
|
125
|
+
expect(@plugin[:filesystem]["/dev/hd4"]['mount']).to eq("/")
|
126
|
+
end
|
127
|
+
|
128
|
+
it "returns the filesystem type" do
|
129
|
+
expect(@plugin[:filesystem]["/dev/hd4"]['fs_type']).to eq("jfs2")
|
130
|
+
end
|
131
|
+
|
132
|
+
it "returns the filesystem mount options" do
|
133
|
+
expect(@plugin[:filesystem]["/dev/hd4"]['mount_options']).to eq(["rw", "log=/dev/hd8"])
|
134
|
+
end
|
135
|
+
|
136
|
+
# For entries like 192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
137
|
+
context "having node values" do
|
138
|
+
|
139
|
+
it "returns the filesystem mount location" do
|
140
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount']).to eq("/stage/middleware")
|
141
|
+
end
|
142
|
+
|
143
|
+
it "returns the filesystem type" do
|
144
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['fs_type']).to eq("nfs3")
|
145
|
+
end
|
146
|
+
|
147
|
+
it "returns the filesystem mount options" do
|
148
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount_options']).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
|
149
|
+
end
|
150
|
+
end
|
88
151
|
end
|
152
|
+
end
|
89
153
|
|
90
|
-
|
91
|
-
|
154
|
+
context 'when run within a WPAR' do
|
155
|
+
before do
|
156
|
+
allow(@plugin).to receive(:shell_out).with("df -Pk").and_return(mock_shell_out(0, @df_Pk_WPAR, nil))
|
157
|
+
allow(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @mount_WPAR, nil))
|
158
|
+
@plugin.run
|
92
159
|
end
|
93
160
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
161
|
+
describe "df -Pk" do
|
162
|
+
|
163
|
+
it "returns the filesystem block size" do
|
164
|
+
expect(@plugin[:filesystem]["Global:/"]['kb_size']).to eq("10485760")
|
165
|
+
end
|
166
|
+
|
167
|
+
it "returns the filesystem used space in kb" do
|
168
|
+
expect(@plugin[:filesystem]["Global:/"]['kb_used']).to eq("130872")
|
169
|
+
end
|
170
|
+
|
171
|
+
it "returns the filesystem available space in kb" do
|
172
|
+
expect(@plugin[:filesystem]["Global:/"]['kb_available']).to eq("10354888")
|
173
|
+
end
|
174
|
+
|
175
|
+
it "returns the filesystem capacity in percentage" do
|
176
|
+
expect(@plugin[:filesystem]["Global:/"]['percent_used']).to eq("2%")
|
98
177
|
end
|
99
178
|
|
179
|
+
it "returns the filesystem mounted location" do
|
180
|
+
expect(@plugin[:filesystem]["Global:/"]['mount']).to eq("/")
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
describe "mount" do
|
185
|
+
|
100
186
|
it "returns the filesystem mount location" do
|
101
|
-
expect(@plugin[:filesystem]["
|
187
|
+
expect(@plugin[:filesystem]["Global:/"]['mount']).to eq("/")
|
102
188
|
end
|
103
189
|
|
104
190
|
it "returns the filesystem type" do
|
105
|
-
expect(@plugin[:filesystem]["
|
191
|
+
expect(@plugin[:filesystem]["Global:/"]['fs_type']).to eq("jfs2")
|
106
192
|
end
|
107
193
|
|
108
194
|
it "returns the filesystem mount options" do
|
109
|
-
expect(@plugin[:filesystem]["
|
195
|
+
expect(@plugin[:filesystem]["Global:/"]['mount_options']).to eq(["rw", "log=NULL"])
|
196
|
+
end
|
197
|
+
|
198
|
+
# For entries like 192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
199
|
+
context "having node values" do
|
200
|
+
|
201
|
+
it "returns the filesystem mount location" do
|
202
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount']).to eq("/stage/middleware")
|
203
|
+
end
|
204
|
+
|
205
|
+
it "returns the filesystem type" do
|
206
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['fs_type']).to eq("nfs3")
|
207
|
+
end
|
208
|
+
|
209
|
+
it "returns the filesystem mount options" do
|
210
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount_options']).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
|
211
|
+
end
|
110
212
|
end
|
111
213
|
end
|
112
214
|
end
|