ohai 6.24.2 → 7.0.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ohai.rb +1 -1
- data/lib/ohai/application.rb +5 -12
- data/lib/ohai/common/dmi.rb +126 -0
- data/lib/ohai/config.rb +9 -9
- data/lib/ohai/{plugins/darwin/hostname.rb → dsl.rb} +7 -7
- data/lib/ohai/dsl/plugin.rb +186 -0
- data/lib/ohai/dsl/plugin/versionvi.rb +62 -0
- data/lib/ohai/dsl/plugin/versionvii.rb +106 -0
- data/lib/ohai/exception.rb +11 -2
- data/lib/ohai/hints.rb +48 -0
- data/lib/ohai/loader.rb +205 -0
- data/lib/ohai/mixin/command.rb +14 -18
- data/lib/ohai/mixin/constant_helper.rb +53 -0
- data/lib/ohai/mixin/gce_metadata.rb +0 -2
- data/lib/ohai/{plugins/freebsd/uptime.rb → mixin/network_constants.rb} +15 -13
- data/lib/ohai/mixin/os.rb +59 -0
- data/lib/ohai/mixin/seconds_to_human.rb +48 -0
- data/lib/ohai/plugins/aix/cpu.rb +26 -22
- data/lib/ohai/plugins/aix/filesystem.rb +47 -48
- data/lib/ohai/plugins/aix/kernel.rb +11 -7
- data/lib/ohai/plugins/aix/memory.rb +8 -4
- data/lib/ohai/plugins/aix/network.rb +73 -82
- data/lib/ohai/plugins/aix/platform.rb +9 -6
- data/lib/ohai/plugins/aix/uptime.rb +14 -12
- data/lib/ohai/plugins/azure.rb +33 -11
- data/lib/ohai/plugins/c.rb +103 -78
- data/lib/ohai/plugins/chef.rb +20 -8
- data/lib/ohai/plugins/cloud.rb +234 -230
- data/lib/ohai/plugins/command.rb +6 -2
- data/lib/ohai/plugins/darwin/cpu.rb +10 -4
- data/lib/ohai/plugins/darwin/filesystem.rb +32 -32
- data/lib/ohai/plugins/darwin/network.rb +157 -154
- data/lib/ohai/plugins/darwin/platform.rb +18 -16
- data/lib/ohai/plugins/darwin/system_profiler.rb +49 -46
- data/lib/ohai/plugins/dmi.rb +102 -102
- data/lib/ohai/plugins/ec2.rb +30 -28
- data/lib/ohai/plugins/erlang.rb +19 -16
- data/lib/ohai/plugins/eucalyptus.rb +37 -36
- data/lib/ohai/plugins/freebsd/cpu.rb +34 -29
- data/lib/ohai/plugins/freebsd/filesystem.rb +32 -32
- data/lib/ohai/plugins/freebsd/memory.rb +35 -25
- data/lib/ohai/plugins/freebsd/network.rb +94 -89
- data/lib/ohai/plugins/freebsd/platform.rb +10 -4
- data/lib/ohai/plugins/freebsd/virtualization.rb +62 -61
- data/lib/ohai/plugins/gce.rb +30 -36
- data/lib/ohai/plugins/groovy.rb +14 -11
- data/lib/ohai/plugins/hostname.rb +132 -10
- data/lib/ohai/plugins/ip_scopes.rb +31 -16
- data/lib/ohai/plugins/java.rb +45 -21
- data/lib/ohai/plugins/kernel.rb +186 -19
- data/lib/ohai/plugins/keys.rb +6 -2
- data/lib/ohai/plugins/languages.rb +6 -2
- data/lib/ohai/plugins/linode.rb +38 -30
- data/lib/ohai/plugins/linux/block_device.rb +19 -15
- data/lib/ohai/plugins/linux/cpu.rb +42 -38
- data/lib/ohai/plugins/linux/filesystem.rb +70 -130
- data/lib/ohai/plugins/linux/lsb.rb +35 -35
- data/lib/ohai/plugins/linux/memory.rb +65 -61
- data/lib/ohai/plugins/linux/network.rb +343 -362
- data/lib/ohai/plugins/linux/platform.rb +90 -88
- data/lib/ohai/plugins/linux/virtualization.rb +95 -90
- data/lib/ohai/plugins/lua.rb +14 -10
- data/lib/ohai/plugins/mono.rb +17 -13
- data/lib/ohai/plugins/netbsd/cpu.rb +25 -23
- data/lib/ohai/plugins/netbsd/filesystem.rb +32 -32
- data/lib/ohai/plugins/netbsd/memory.rb +59 -59
- data/lib/ohai/plugins/netbsd/network.rb +92 -88
- data/lib/ohai/plugins/netbsd/platform.rb +10 -3
- data/lib/ohai/plugins/netbsd/virtualization.rb +41 -38
- data/lib/ohai/plugins/network.rb +131 -130
- data/lib/ohai/plugins/network_listeners.rb +26 -22
- data/lib/ohai/plugins/nodejs.rb +14 -10
- data/lib/ohai/plugins/ohai.rb +11 -6
- data/lib/ohai/plugins/ohai_time.rb +6 -2
- data/lib/ohai/plugins/openbsd/cpu.rb +20 -15
- data/lib/ohai/plugins/openbsd/filesystem.rb +32 -32
- data/lib/ohai/plugins/openbsd/memory.rb +59 -59
- data/lib/ohai/plugins/openbsd/network.rb +92 -88
- data/lib/ohai/plugins/openbsd/platform.rb +10 -4
- data/lib/ohai/plugins/openbsd/virtualization.rb +41 -39
- data/lib/ohai/plugins/openstack.rb +23 -21
- data/lib/ohai/plugins/os.rb +8 -32
- data/lib/ohai/plugins/passwd.rb +27 -22
- data/lib/ohai/plugins/perl.rb +21 -16
- data/lib/ohai/plugins/php.rb +15 -12
- data/lib/ohai/plugins/platform.rb +9 -9
- data/lib/ohai/plugins/{linux/kernel.rb → ps.rb} +13 -12
- data/lib/ohai/plugins/python.rb +16 -12
- data/lib/ohai/plugins/rackspace.rb +82 -77
- data/lib/ohai/plugins/root_group.rb +13 -9
- data/lib/ohai/plugins/ruby.rb +50 -48
- data/lib/ohai/plugins/sigar/cpu.rb +21 -17
- data/lib/ohai/plugins/sigar/filesystem.rb +26 -23
- data/lib/ohai/plugins/sigar/memory.rb +17 -14
- data/lib/ohai/plugins/sigar/network.rb +133 -67
- data/lib/ohai/plugins/sigar/network_route.rb +33 -28
- data/lib/ohai/plugins/sigar/platform.rb +10 -6
- data/lib/ohai/plugins/solaris2/cpu.rb +41 -33
- data/lib/ohai/plugins/solaris2/dmi.rb +146 -146
- data/lib/ohai/plugins/solaris2/filesystem.rb +74 -77
- data/lib/ohai/plugins/{aix/hostname.rb → solaris2/memory.rb} +7 -4
- data/lib/ohai/plugins/solaris2/network.rb +91 -86
- data/lib/ohai/plugins/solaris2/platform.rb +40 -36
- data/lib/ohai/plugins/solaris2/virtualization.rb +54 -59
- data/lib/ohai/plugins/solaris2/zpools.rb +38 -38
- data/lib/ohai/plugins/ssh_host_key.rb +49 -45
- data/lib/ohai/plugins/uptime.rb +87 -25
- data/lib/ohai/plugins/virtualization.rb +59 -55
- data/lib/ohai/plugins/windows/cpu.rb +44 -40
- data/lib/ohai/plugins/windows/filesystem.rb +28 -22
- data/lib/ohai/plugins/windows/network.rb +88 -79
- data/lib/ohai/plugins/windows/platform.rb +10 -3
- data/lib/ohai/provides_map.rb +184 -0
- data/lib/ohai/runner.rb +109 -0
- data/lib/ohai/system.rb +103 -184
- data/lib/ohai/version.rb +4 -3
- data/spec/data/plugins/___lib64___libc.so.6.output +135 -0
- data/spec/data/plugins/___lib___libc.so.6.output +135 -0
- data/spec/data/plugins/cc.output +135 -0
- data/spec/data/plugins/cl.output +135 -0
- data/spec/data/plugins/devenv.com.output +135 -0
- data/spec/data/plugins/env.output +71 -0
- data/spec/data/plugins/erl.output +144 -0
- data/spec/data/plugins/gcc.output +135 -0
- data/spec/data/plugins/groovy.output +159 -0
- data/spec/data/plugins/java.output +143 -0
- data/spec/data/plugins/lua.output +143 -0
- data/spec/data/plugins/messages.rb +8 -0
- data/spec/data/plugins/node.output +143 -0
- data/spec/data/plugins/perl.output +143 -0
- data/spec/data/plugins/php.output +143 -0
- data/spec/data/plugins/python.output +143 -0
- data/spec/data/plugins/uname.output +71 -0
- data/spec/data/plugins/v6message.rb +2 -0
- data/spec/data/plugins/v7message.rb +7 -0
- data/spec/data/plugins/what.output +135 -0
- data/spec/data/plugins/xlc.output +135 -0
- data/spec/spec_helper.rb +52 -18
- data/spec/support/integration_helper.rb +44 -0
- data/spec/unit/dsl/plugin_spec.rb +298 -0
- data/spec/unit/hints_spec.rb +65 -0
- data/spec/unit/loader_spec.rb +226 -0
- data/spec/unit/mixin/ec2_metadata_spec.rb +9 -9
- data/spec/unit/plugins/aix/cpu_spec.rb +17 -18
- data/spec/unit/plugins/aix/filesystem_spec.rb +20 -18
- data/spec/unit/plugins/aix/hostname_spec.rb +8 -4
- data/spec/unit/plugins/aix/kernel_spec.rb +13 -12
- data/spec/unit/plugins/aix/network_spec.rb +66 -45
- data/spec/unit/plugins/aix/platform_spec.rb +11 -10
- data/spec/unit/plugins/aix/uptime_spec.rb +7 -8
- data/spec/unit/plugins/azure_spec.rb +20 -21
- data/spec/unit/plugins/c_spec.rb +88 -87
- data/spec/unit/plugins/chef_spec.rb +5 -6
- data/spec/unit/plugins/cloud_spec.rb +81 -82
- data/spec/unit/plugins/darwin/cpu_spec.rb +8 -9
- data/spec/unit/plugins/darwin/hostname_spec.rb +23 -11
- data/spec/unit/plugins/darwin/kernel_spec.rb +39 -16
- data/spec/unit/plugins/darwin/network_spec.rb +375 -378
- data/spec/unit/plugins/darwin/platform_spec.rb +23 -50
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +7 -8
- data/spec/unit/plugins/dmi_spec.rb +7 -12
- data/spec/unit/plugins/ec2_spec.rb +70 -59
- data/spec/unit/plugins/erlang_spec.rb +18 -20
- data/spec/unit/plugins/eucalyptus_spec.rb +37 -33
- data/spec/unit/plugins/fail_spec.rb +276 -23
- data/spec/unit/plugins/freebsd/hostname_spec.rb +11 -9
- data/spec/unit/plugins/freebsd/kernel_spec.rb +8 -8
- data/spec/unit/plugins/freebsd/platform_spec.rb +9 -10
- data/spec/unit/plugins/freebsd/virtualization_spec.rb +32 -32
- data/spec/unit/plugins/gce_spec.rb +19 -25
- data/spec/unit/plugins/groovy_spec.rb +10 -16
- data/spec/unit/plugins/hostname_spec.rb +45 -20
- data/spec/unit/plugins/ip_scopes_spec.rb +97 -0
- data/spec/unit/plugins/java_spec.rb +145 -99
- data/spec/unit/plugins/kernel_spec.rb +51 -15
- data/spec/unit/plugins/linode_spec.rb +31 -29
- data/spec/unit/plugins/linux/cpu_spec.rb +42 -43
- data/spec/unit/plugins/linux/filesystem_spec.rb +143 -324
- data/spec/unit/plugins/linux/hostname_spec.rb +16 -23
- data/spec/unit/plugins/linux/kernel_spec.rb +22 -8
- data/spec/unit/plugins/linux/lsb_spec.rb +54 -56
- data/spec/unit/plugins/linux/network_spec.rb +196 -238
- data/spec/unit/plugins/linux/platform_spec.rb +186 -205
- data/spec/unit/plugins/linux/uptime_spec.rb +13 -25
- data/spec/unit/plugins/linux/virtualization_spec.rb +149 -129
- data/spec/unit/plugins/lua_spec.rb +12 -15
- data/spec/unit/plugins/mono_spec.rb +10 -15
- data/spec/unit/plugins/netbsd/hostname_spec.rb +17 -7
- data/spec/unit/plugins/netbsd/kernel_spec.rb +8 -8
- data/spec/unit/plugins/netbsd/platform_spec.rb +8 -10
- data/spec/unit/plugins/network_spec.rb +358 -235
- data/spec/unit/plugins/nodejs_spec.rb +13 -15
- data/spec/unit/plugins/ohai_spec.rb +3 -4
- data/spec/unit/plugins/ohai_time_spec.rb +8 -9
- data/spec/unit/plugins/openbsd/hostname_spec.rb +21 -11
- data/spec/unit/plugins/openbsd/kernel_spec.rb +8 -8
- data/spec/unit/plugins/openbsd/platform_spec.rb +6 -12
- data/spec/unit/plugins/openstack_spec.rb +214 -0
- data/spec/unit/plugins/os_spec.rb +13 -16
- data/spec/unit/plugins/passwd_spec.rb +12 -13
- data/spec/unit/plugins/perl_spec.rb +20 -44
- data/spec/unit/plugins/php_spec.rb +20 -15
- data/spec/unit/plugins/platform_spec.rb +24 -29
- data/spec/unit/plugins/python_spec.rb +13 -17
- data/spec/unit/plugins/rackspace_spec.rb +90 -57
- data/spec/unit/plugins/root_group_spec.rb +17 -19
- data/spec/unit/plugins/ruby_spec.rb +15 -16
- data/spec/unit/plugins/sigar/network_route_spec.rb +12 -13
- data/spec/unit/plugins/solaris2/cpu_spec.rb +82 -0
- data/spec/unit/plugins/solaris2/hostname_spec.rb +12 -13
- data/spec/unit/plugins/solaris2/kernel_spec.rb +11 -15
- data/{lib/ohai/plugins/openbsd/uptime.rb → spec/unit/plugins/solaris2/memory_spec.rb} +10 -12
- data/spec/unit/plugins/solaris2/network_spec.rb +44 -20
- data/spec/unit/plugins/solaris2/platform_spec.rb +13 -22
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +37 -45
- data/spec/unit/plugins/ssh_host_keys_spec.rb +11 -15
- data/spec/unit/provides_map_spec.rb +208 -0
- data/spec/unit/runner_spec.rb +488 -0
- data/spec/unit/system_spec.rb +639 -104
- metadata +151 -87
- checksums.yaml +0 -7
- data/lib/ohai/mixin/from_file.rb +0 -36
- data/lib/ohai/plugins/aix/ps.rb +0 -23
- data/lib/ohai/plugins/darwin/kernel.rb +0 -37
- data/lib/ohai/plugins/darwin/ps.rb +0 -23
- data/lib/ohai/plugins/darwin/uptime.rb +0 -32
- data/lib/ohai/plugins/dmi_common.rb +0 -121
- data/lib/ohai/plugins/freebsd/hostname.rb +0 -22
- data/lib/ohai/plugins/freebsd/kernel.rb +0 -37
- data/lib/ohai/plugins/freebsd/ps.rb +0 -24
- data/lib/ohai/plugins/hpux/cpu.rb +0 -19
- data/lib/ohai/plugins/hpux/filesystem.rb +0 -19
- data/lib/ohai/plugins/hpux/hostname.rb +0 -19
- data/lib/ohai/plugins/hpux/memory.rb +0 -19
- data/lib/ohai/plugins/hpux/network.rb +0 -19
- data/lib/ohai/plugins/hpux/platform.rb +0 -19
- data/lib/ohai/plugins/hpux/ps.rb +0 -23
- data/lib/ohai/plugins/hpux/uptime.rb +0 -19
- data/lib/ohai/plugins/linux/hostname.rb +0 -40
- data/lib/ohai/plugins/linux/ps.rb +0 -23
- data/lib/ohai/plugins/linux/uptime.rb +0 -28
- data/lib/ohai/plugins/netbsd/hostname.rb +0 -22
- data/lib/ohai/plugins/netbsd/kernel.rb +0 -35
- data/lib/ohai/plugins/netbsd/ps.rb +0 -24
- data/lib/ohai/plugins/netbsd/uptime.rb +0 -31
- data/lib/ohai/plugins/openbsd/hostname.rb +0 -22
- data/lib/ohai/plugins/openbsd/kernel.rb +0 -35
- data/lib/ohai/plugins/openbsd/ps.rb +0 -24
- data/lib/ohai/plugins/sigar/hostname.rb +0 -28
- data/lib/ohai/plugins/sigar/uptime.rb +0 -27
- data/lib/ohai/plugins/solaris2/hostname.rb +0 -34
- data/lib/ohai/plugins/solaris2/kernel.rb +0 -40
- data/lib/ohai/plugins/solaris2/ps.rb +0 -23
- data/lib/ohai/plugins/solaris2/uptime.rb +0 -36
- data/lib/ohai/plugins/windows/hostname.rb +0 -33
- data/lib/ohai/plugins/windows/kernel.rb +0 -58
- data/lib/ohai/plugins/windows/kernel_devices.rb +0 -39
- data/lib/ohai/plugins/windows/uptime.rb +0 -23
- data/spec/unit/mixin/from_file_spec.rb +0 -53
@@ -22,15 +22,15 @@ require 'ohai/mixin/ec2_metadata'
|
|
22
22
|
describe Ohai::Mixin::Ec2Metadata do
|
23
23
|
let(:mixin) {
|
24
24
|
metadata_object = Object.new.extend(Ohai::Mixin::Ec2Metadata)
|
25
|
-
http_client =
|
26
|
-
http_client.stub
|
27
|
-
metadata_object.stub
|
25
|
+
http_client = double("Net::HTTP client")
|
26
|
+
http_client.stub(:get).and_return(response)
|
27
|
+
metadata_object.stub(:http_client).and_return(http_client)
|
28
28
|
metadata_object
|
29
29
|
}
|
30
30
|
|
31
31
|
context "#best_api_version" do
|
32
32
|
context "with a sorted list of metadata versions" do
|
33
|
-
let(:response) {
|
33
|
+
let(:response) { double("Net::HTTP Response", :body => "1.0\n2011-05-01\n2012-01-12\nUnsupported", :code => "200") }
|
34
34
|
|
35
35
|
it "returns the most recent version" do
|
36
36
|
mixin.best_api_version.should == "2012-01-12"
|
@@ -38,7 +38,7 @@ describe Ohai::Mixin::Ec2Metadata do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
context "with an unsorted list of metadata versions" do
|
41
|
-
let(:response) {
|
41
|
+
let(:response) { double("Net::HTTP Response", :body => "1.0\n2009-04-04\n2007-03-01\n2011-05-01\n2008-09-01\nUnsupported", :code => "200") }
|
42
42
|
|
43
43
|
it "returns the most recent version (using string sort)" do
|
44
44
|
mixin.best_api_version.should == "2011-05-01"
|
@@ -46,7 +46,7 @@ describe Ohai::Mixin::Ec2Metadata do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
context "when no supported versions are found" do
|
49
|
-
let(:response) {
|
49
|
+
let(:response) { double("Net::HTTP Response", :body => "2020-01-01\nUnsupported", :code => "200") }
|
50
50
|
|
51
51
|
it "raises an error" do
|
52
52
|
lambda { mixin.best_api_version}.should raise_error
|
@@ -54,7 +54,7 @@ describe Ohai::Mixin::Ec2Metadata do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
context "when the response code is 404" do
|
57
|
-
let(:response) {
|
57
|
+
let(:response) { double("Net::HTTP Response", :body => "1.0\n2011-05-01\n2012-01-12\nUnsupported", :code => "404") }
|
58
58
|
|
59
59
|
it "raises an error" do
|
60
60
|
lambda { mixin.best_api_version}.should raise_error
|
@@ -62,7 +62,7 @@ describe Ohai::Mixin::Ec2Metadata do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
context "when the response code is unexpected" do
|
65
|
-
let(:response) {
|
65
|
+
let(:response) { double("Net::HTTP Response", :body => "1.0\n2011-05-01\n2012-01-12\nUnsupported", :code => "418") }
|
66
66
|
|
67
67
|
it "raises an error" do
|
68
68
|
lambda { mixin.best_api_version}.should raise_error
|
@@ -72,7 +72,7 @@ describe Ohai::Mixin::Ec2Metadata do
|
|
72
72
|
|
73
73
|
context "#metadata_get" do
|
74
74
|
context "when the response code is unexpected" do
|
75
|
-
let(:response) {
|
75
|
+
let(:response) { double("Net::HTTP Response", :body => "", :code => "418") }
|
76
76
|
|
77
77
|
it "raises an error" do
|
78
78
|
lambda { mixin.metadata_get('', '2012-01-12') }.should raise_error(RuntimeError)
|
@@ -31,51 +31,50 @@ smt_threads 2 Processor SMT threads False
|
|
31
31
|
state enable Processor state False
|
32
32
|
type PowerPC_POWER5 Processor type False
|
33
33
|
LSATTR_EL
|
34
|
-
@
|
35
|
-
@
|
36
|
-
@ohai[:os] = "aix"
|
34
|
+
@plugin = get_plugin("aix/cpu")
|
35
|
+
@plugin.stub(:collect_os).and_return(:aix)
|
37
36
|
|
38
|
-
@
|
39
|
-
@
|
40
|
-
@
|
37
|
+
@plugin.stub(:shell_out).with("lsdev -Cc processor").and_return(mock_shell_out(0, @lsdev_Cc_processor, nil))
|
38
|
+
@plugin.stub(:shell_out).with("lsattr -El proc0").and_return(mock_shell_out(0, @lsattr_El_proc0, nil))
|
39
|
+
@plugin.run
|
41
40
|
end
|
42
41
|
|
43
42
|
|
44
43
|
it "sets the vendor id to IBM" do
|
45
|
-
@
|
44
|
+
@plugin[:cpu][:vendor_id].should == "IBM"
|
46
45
|
end
|
47
46
|
|
48
47
|
it "sets the available attribute" do
|
49
|
-
@
|
48
|
+
@plugin[:cpu][:available].should == 1
|
50
49
|
end
|
51
50
|
|
52
51
|
it "sets the total number of devices" do
|
53
|
-
@
|
52
|
+
@plugin[:cpu][:total].should == 2
|
54
53
|
end
|
55
54
|
|
56
55
|
it "detects the model" do
|
57
|
-
@
|
56
|
+
@plugin[:cpu][:model].should == "PowerPC_POWER5"
|
58
57
|
end
|
59
58
|
|
60
59
|
it "detects the mhz" do
|
61
|
-
@
|
60
|
+
@plugin[:cpu][:mhz].should == 1615570
|
62
61
|
end
|
63
62
|
|
64
63
|
it "detects the status of the device" do
|
65
|
-
@
|
64
|
+
@plugin[:cpu][:proc0][:status].should == "Available"
|
66
65
|
end
|
67
66
|
|
68
67
|
it "detects the location of the device" do
|
69
|
-
@
|
68
|
+
@plugin[:cpu][:proc0][:location].should == "00-00"
|
70
69
|
end
|
71
70
|
|
72
71
|
context "lsattr -El device_name" do
|
73
72
|
it "detects all the attributes of the device" do
|
74
|
-
@
|
75
|
-
@
|
76
|
-
@
|
77
|
-
@
|
78
|
-
@
|
73
|
+
@plugin[:cpu][:proc0][:frequency].should == "1654344000"
|
74
|
+
@plugin[:cpu][:proc0][:smt_enabled].should == "true"
|
75
|
+
@plugin[:cpu][:proc0][:smt_threads].should == "2"
|
76
|
+
@plugin[:cpu][:proc0][:state].should == "enable"
|
77
|
+
@plugin[:cpu][:proc0][:type].should == "PowerPC_POWER5"
|
79
78
|
end
|
80
79
|
end
|
81
80
|
end
|
@@ -45,66 +45,68 @@ DF_P
|
|
45
45
|
192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
46
46
|
MOUNT
|
47
47
|
|
48
|
-
@
|
49
|
-
@
|
50
|
-
@
|
51
|
-
@
|
52
|
-
@
|
53
|
-
|
48
|
+
@plugin = get_plugin("aix/filesystem")
|
49
|
+
@plugin.stub(:collect_os).and_return(:aix)
|
50
|
+
@plugin[:filesystem] = Mash.new
|
51
|
+
@plugin.stub(:shell_out).with("df -P").and_return(mock_shell_out(0, @df_P, nil))
|
52
|
+
@plugin.stub(:shell_out).with("mount").and_return(mock_shell_out(0, @mount, nil))
|
53
|
+
|
54
|
+
@plugin.run
|
54
55
|
end
|
55
56
|
|
56
57
|
describe "df -P" do
|
57
58
|
|
58
59
|
it "returns the filesystem block size" do
|
59
|
-
@
|
60
|
+
@plugin[:filesystem]["/dev/hd4"]['kb_size'].should == "786432"
|
60
61
|
end
|
61
62
|
|
62
63
|
it "returns the filesystem used space in kb" do
|
63
|
-
@
|
64
|
+
@plugin[:filesystem]["/dev/hd4"]['kb_used'].should == "495632"
|
64
65
|
end
|
65
66
|
|
66
67
|
it "returns the filesystem available space in kb" do
|
67
|
-
@
|
68
|
+
@plugin[:filesystem]["/dev/hd4"]['kb_available'].should == "290800"
|
68
69
|
end
|
69
70
|
|
70
71
|
it "returns the filesystem capacity in percentage" do
|
71
|
-
@
|
72
|
+
@plugin[:filesystem]["/dev/hd4"]['percent_used'].should == "64%"
|
72
73
|
end
|
73
74
|
|
74
75
|
it "returns the filesystem mounted location" do
|
75
|
-
@
|
76
|
+
@plugin[:filesystem]["/dev/hd4"]['mount'].should == "/"
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
79
80
|
describe "mount" do
|
80
81
|
|
81
82
|
it "returns the filesystem mount location" do
|
82
|
-
@
|
83
|
+
@plugin[:filesystem]["/dev/hd4"]['mount'].should == "/"
|
83
84
|
end
|
84
85
|
|
85
86
|
it "returns the filesystem type" do
|
86
|
-
@
|
87
|
+
@plugin[:filesystem]["/dev/hd4"]['fs_type'].should == "jfs2"
|
87
88
|
end
|
88
89
|
|
89
90
|
it "returns the filesystem mount options" do
|
90
|
-
@
|
91
|
+
@plugin[:filesystem]["/dev/hd4"]['mount_options'].should == "rw,log=/dev/hd8"
|
91
92
|
end
|
92
93
|
|
93
94
|
# For entries like 192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
94
95
|
context "having node values" do
|
95
96
|
before do
|
96
|
-
@
|
97
|
+
@plugin.stub(:shell_out).with("df -P").and_return(mock_shell_out(0, "192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys", nil))
|
97
98
|
end
|
99
|
+
|
98
100
|
it "returns the filesystem mount location" do
|
99
|
-
@
|
101
|
+
@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount'].should == "/stage/middleware"
|
100
102
|
end
|
101
103
|
|
102
104
|
it "returns the filesystem type" do
|
103
|
-
@
|
105
|
+
@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['fs_type'].should == "nfs3"
|
104
106
|
end
|
105
107
|
|
106
108
|
it "returns the filesystem mount options" do
|
107
|
-
@
|
109
|
+
@plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount_options'].should == "ro,bg,hard,intr,sec=sys"
|
108
110
|
end
|
109
111
|
end
|
110
112
|
end
|
@@ -19,10 +19,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
|
|
19
19
|
|
20
20
|
describe Ohai::System, "Aix hostname plugin" do
|
21
21
|
before(:each) do
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
22
|
+
@plugin = get_plugin("hostname")
|
23
|
+
@plugin.stub(:collect_os).and_return(:aix)
|
24
|
+
@plugin.stub(:from_cmd).with("hostname").and_return("aix_admin")
|
25
|
+
@plugin.run
|
25
26
|
end
|
26
27
|
|
27
|
-
|
28
|
+
it "should set the machinename" do
|
29
|
+
@plugin[:machinename].should eql("aix_admin")
|
30
|
+
end
|
28
31
|
end
|
32
|
+
|
@@ -19,33 +19,34 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
|
|
19
19
|
|
20
20
|
describe Ohai::System, "AIX kernel plugin" do
|
21
21
|
before(:each) do
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
@
|
22
|
+
@plugin = get_plugin("aix/kernel")
|
23
|
+
@plugin.stub(:collect_os).and_return(:aix)
|
24
|
+
@plugin.stub(:shell_out).with("uname -s").and_return(mock_shell_out(0, "AIX", nil))
|
25
|
+
@plugin.stub(:shell_out).with("uname -r").and_return(mock_shell_out(0, "1", nil))
|
26
|
+
@plugin.stub(:shell_out).with("uname -v").and_return(mock_shell_out(0, "6", nil))
|
27
|
+
@plugin.stub(:shell_out).with("uname -p").and_return(mock_shell_out(0, "powerpc", nil))
|
27
28
|
@modules = Mash.new
|
28
|
-
@
|
29
|
-
@
|
29
|
+
@plugin.stub(:modules).and_return(@modules)
|
30
|
+
@plugin.run
|
30
31
|
end
|
31
32
|
|
32
33
|
it "uname -s detects the name" do
|
33
|
-
@
|
34
|
+
@plugin[:kernel][:name].should == "aix"
|
34
35
|
end
|
35
36
|
|
36
37
|
it "uname -r detects the release" do
|
37
|
-
@
|
38
|
+
@plugin[:kernel][:release].should == "1"
|
38
39
|
end
|
39
40
|
|
40
41
|
it "uname -v detects the version" do
|
41
|
-
@
|
42
|
+
@plugin[:kernel][:version].should == "6"
|
42
43
|
end
|
43
44
|
|
44
45
|
it "uname -p detects the machine" do
|
45
|
-
@
|
46
|
+
@plugin[:kernel][:machine].should == "powerpc"
|
46
47
|
end
|
47
48
|
|
48
49
|
it "detects the modules" do
|
49
|
-
@
|
50
|
+
@plugin[:kernel][:modules].should == @modules
|
50
51
|
end
|
51
52
|
end
|
@@ -71,68 +71,78 @@ bucket: 0 contains: 0 entries
|
|
71
71
|
There are 6 entries in the arp table.
|
72
72
|
ARP_AN
|
73
73
|
|
74
|
-
@
|
75
|
-
@
|
76
|
-
@
|
77
|
-
@
|
78
|
-
@
|
79
|
-
@
|
80
|
-
@
|
81
|
-
@
|
82
|
-
@
|
83
|
-
@
|
84
|
-
@ohai._require_plugin("aix::network")
|
74
|
+
@plugin = get_plugin("aix/network")
|
75
|
+
@plugin.stub(:collect_os).and_return(:aix)
|
76
|
+
@plugin[:network] = Mash.new
|
77
|
+
@plugin.stub(:shell_out).with("route -n get 0").and_return(mock_shell_out(0, @route_n_get_0, nil))
|
78
|
+
@plugin.stub(:shell_out).with("lsdev -Cc if").and_return(mock_shell_out(0, @lsdev_Cc_if, nil))
|
79
|
+
@plugin.stub(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, @ifconfig_en0, nil))
|
80
|
+
@plugin.stub(:shell_out).with("entstat -d en0 | grep \"Hardware Address\"").and_return(mock_shell_out(0, "Hardware Address: be:42:80:00:b0:05", nil))
|
81
|
+
@plugin.stub(:shell_out).with("netstat -nrf inet").and_return(mock_shell_out(0, @netstat_nrf_inet, nil))
|
82
|
+
@plugin.stub(:shell_out).with("netstat -nrf inet6").and_return(mock_shell_out(0, "::1%1 ::1%1 UH 1 109392 en0 - -", nil))
|
83
|
+
@plugin.stub(:shell_out).with("arp -an").and_return(mock_shell_out(0, @aix_arp_an, nil))
|
85
84
|
end
|
86
85
|
|
87
86
|
describe "run" do
|
87
|
+
before do
|
88
|
+
@plugin.run
|
89
|
+
end
|
88
90
|
|
89
91
|
it "detects network information" do
|
90
|
-
@
|
92
|
+
@plugin['network'].should_not be_nil
|
91
93
|
end
|
92
94
|
|
93
95
|
it "detects the interfaces" do
|
94
|
-
@
|
96
|
+
@plugin['network']['interfaces'].keys.sort.should == ["en0"]
|
95
97
|
end
|
96
98
|
|
97
99
|
it "detects the ip addresses of the interfaces" do
|
98
|
-
@
|
100
|
+
@plugin['network']['interfaces']['en0']['addresses'].keys.should include('172.29.174.58')
|
99
101
|
end
|
100
102
|
end
|
101
103
|
|
102
104
|
describe "route -n get 0" do
|
105
|
+
before do
|
106
|
+
@plugin.run
|
107
|
+
end
|
103
108
|
|
104
109
|
it "returns the default gateway of the system's network" do
|
105
|
-
@
|
110
|
+
@plugin[:network][:default_gateway].should == '172.29.128.13'
|
106
111
|
end
|
107
112
|
|
108
113
|
it "returns the default interface of the system's network" do
|
109
|
-
@
|
114
|
+
@plugin[:network][:default_interface].should == 'en0'
|
110
115
|
end
|
111
116
|
end
|
112
117
|
|
113
118
|
describe "lsdev -Cc if" do
|
114
|
-
|
115
119
|
it "detects the state of the interfaces in the system" do
|
116
|
-
@
|
120
|
+
@plugin.run
|
121
|
+
@plugin['network']['interfaces']['en0'][:state].should == "up"
|
117
122
|
end
|
118
123
|
|
119
124
|
it "detects the description of the interfaces in the system" do
|
120
|
-
@
|
125
|
+
@plugin.run
|
126
|
+
@plugin['network']['interfaces']['en0'][:description].should == "Standard Ethernet Network Interface"
|
121
127
|
end
|
122
128
|
|
123
129
|
describe "ifconfig interface" do
|
124
130
|
it "detects the CHAIN network flag" do
|
125
|
-
@
|
131
|
+
@plugin.run
|
132
|
+
@plugin['network']['interfaces']['en0'][:flags].should include('CHAIN')
|
126
133
|
end
|
127
134
|
|
128
135
|
it "detects the metric network flag" do
|
129
|
-
@
|
136
|
+
@plugin.run
|
137
|
+
@plugin['network']['interfaces']['en0'][:metric].should == '1'
|
130
138
|
end
|
131
139
|
|
132
140
|
context "inet entries" do
|
133
141
|
before do
|
134
|
-
@
|
142
|
+
@plugin.run
|
143
|
+
@inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["172.29.174.58"]
|
135
144
|
end
|
145
|
+
|
136
146
|
it "detects the family" do
|
137
147
|
@inet_entry[:family].should == 'inet'
|
138
148
|
end
|
@@ -146,23 +156,24 @@ ARP_AN
|
|
146
156
|
end
|
147
157
|
|
148
158
|
it "detects all key-values" do
|
149
|
-
@
|
150
|
-
@
|
151
|
-
@
|
159
|
+
@plugin['network']['interfaces']['en0'][:tcp_sendspace].should == "262144"
|
160
|
+
@plugin['network']['interfaces']['en0'][:tcp_recvspace].should == "262144"
|
161
|
+
@plugin['network']['interfaces']['en0'][:rfc1323].should == "1"
|
152
162
|
end
|
153
163
|
|
154
164
|
# For an output with no netmask like inet 172.29.174.59 broadcast 172.29.191.255
|
155
165
|
context "with no netmask in the output" do
|
156
166
|
before do
|
157
|
-
@
|
158
|
-
@ohai.stub(:popen4).with("ifconfig en0").and_yield(nil, StringIO.new, StringIO.new("inet 172.29.174.59 broadcast 172.29.191.255"), nil)
|
167
|
+
@plugin.stub(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, "inet 172.29.174.59 broadcast 172.29.191.255", nil))
|
159
168
|
end
|
160
169
|
|
161
170
|
it "detects the default prefixlen" do
|
171
|
+
@inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["172.29.174.59"]
|
162
172
|
@inet_entry[:prefixlen].should == '32'
|
163
173
|
end
|
164
174
|
|
165
175
|
it "detects the default netmask" do
|
176
|
+
@inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["172.29.174.59"]
|
166
177
|
@inet_entry[:netmask].should == '255.255.255.255'
|
167
178
|
end
|
168
179
|
end
|
@@ -170,8 +181,9 @@ ARP_AN
|
|
170
181
|
|
171
182
|
context "inet6 entries" do
|
172
183
|
before do
|
173
|
-
@
|
174
|
-
@
|
184
|
+
@plugin.stub(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, "inet6 ::1%1/0", nil))
|
185
|
+
@plugin.run
|
186
|
+
@inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["::1%1"]
|
175
187
|
end
|
176
188
|
|
177
189
|
it "detects the prefixlen" do
|
@@ -186,7 +198,8 @@ ARP_AN
|
|
186
198
|
|
187
199
|
context "entstat -d interface" do
|
188
200
|
before do
|
189
|
-
@
|
201
|
+
@plugin.run
|
202
|
+
@inet_interface_addresses = @plugin['network']['interfaces']['en0'][:addresses]["BE:42:80:00:B0:05"]
|
190
203
|
end
|
191
204
|
it "detects the family" do
|
192
205
|
@inet_interface_addresses[:family].should == 'lladdr'
|
@@ -195,64 +208,72 @@ ARP_AN
|
|
195
208
|
end
|
196
209
|
|
197
210
|
describe "netstat -nrf family" do
|
198
|
-
|
211
|
+
before do
|
212
|
+
@plugin.run
|
213
|
+
end
|
199
214
|
|
215
|
+
context "inet" do
|
200
216
|
it "detects the route destinations" do
|
201
|
-
@
|
202
|
-
@
|
217
|
+
@plugin['network']['interfaces']['en0'][:routes][0][:destination].should == "default"
|
218
|
+
@plugin['network']['interfaces']['en0'][:routes][1][:destination].should == "172.29.128.0"
|
203
219
|
end
|
204
220
|
|
205
221
|
it "detects the route family" do
|
206
|
-
@
|
222
|
+
@plugin['network']['interfaces']['en0'][:routes][0][:family].should == "inet"
|
207
223
|
end
|
208
224
|
|
209
225
|
it "detects the route gateway" do
|
210
|
-
@
|
226
|
+
@plugin['network']['interfaces']['en0'][:routes][0][:via].should == "172.29.128.13"
|
211
227
|
end
|
212
228
|
|
213
229
|
it "detects the route flags" do
|
214
|
-
@
|
230
|
+
@plugin['network']['interfaces']['en0'][:routes][0][:flags].should == "UG"
|
215
231
|
end
|
216
232
|
end
|
217
233
|
|
218
234
|
context "inet6" do
|
219
235
|
|
220
236
|
it "detects the route destinations" do
|
221
|
-
@
|
237
|
+
@plugin['network']['interfaces']['en0'][:routes][4][:destination].should == "::1%1"
|
222
238
|
end
|
223
239
|
|
224
240
|
it "detects the route family" do
|
225
|
-
@
|
241
|
+
@plugin['network']['interfaces']['en0'][:routes][4][:family].should == "inet6"
|
226
242
|
end
|
227
243
|
|
228
244
|
it "detects the route gateway" do
|
229
|
-
@
|
245
|
+
@plugin['network']['interfaces']['en0'][:routes][4][:via].should == "::1%1"
|
230
246
|
end
|
231
247
|
|
232
248
|
it "detects the route flags" do
|
233
|
-
@
|
249
|
+
@plugin['network']['interfaces']['en0'][:routes][4][:flags].should == "UH"
|
234
250
|
end
|
235
251
|
end
|
236
252
|
end
|
237
253
|
|
238
254
|
describe "arp -an" do
|
239
|
-
|
255
|
+
before do
|
256
|
+
@plugin.run
|
257
|
+
end
|
240
258
|
it "supresses the hostname entries" do
|
241
|
-
@
|
259
|
+
@plugin['network']['arp'][0][:remote_host].should == "?"
|
242
260
|
end
|
243
261
|
|
244
262
|
it "detects the remote ip entry" do
|
245
|
-
@
|
263
|
+
@plugin['network']['arp'][0][:remote_ip].should == "172.29.131.16"
|
246
264
|
end
|
247
265
|
|
248
266
|
it "detects the remote mac entry" do
|
249
|
-
@
|
267
|
+
@plugin['network']['arp'][0][:remote_mac].should == "6e:87:70:0:40:3"
|
250
268
|
end
|
251
269
|
end
|
252
270
|
|
253
271
|
describe "hex_to_dec_netmask method" do
|
272
|
+
before do
|
273
|
+
@plugin.run
|
274
|
+
end
|
254
275
|
it "converts a netmask from hexadecimal form to decimal form" do
|
255
|
-
@
|
276
|
+
@plugin.hex_to_dec_netmask('0xffff0000').should == "255.255.0.0"
|
256
277
|
end
|
257
278
|
end
|
258
279
|
end
|