ohai 8.10.0 → 8.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/Rakefile +13 -4
- data/bin/ohai +3 -4
- data/lib/ohai.rb +4 -4
- data/lib/ohai/application.rb +7 -6
- data/lib/ohai/common/dmi.rb +56 -56
- data/lib/ohai/config.rb +12 -8
- data/lib/ohai/dsl.rb +3 -3
- data/lib/ohai/dsl/plugin.rb +5 -5
- data/lib/ohai/dsl/plugin/versionvi.rb +0 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -0
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +7 -7
- data/lib/ohai/log.rb +1 -1
- data/lib/ohai/mash.rb +3 -2
- data/lib/ohai/mixin/command.rb +25 -23
- data/lib/ohai/mixin/dmi_decode.rb +10 -10
- data/lib/ohai/mixin/ec2_metadata.rb +40 -39
- data/lib/ohai/mixin/gce_metadata.rb +9 -9
- data/lib/ohai/mixin/network_constants.rb +1 -1
- data/lib/ohai/mixin/os.rb +3 -3
- data/lib/ohai/mixin/seconds_to_human.rb +0 -2
- data/lib/ohai/mixin/softlayer_metadata.rb +10 -10
- data/lib/ohai/mixin/string.rb +2 -2
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/cpu.rb +2 -2
- data/lib/ohai/plugins/aix/filesystem.rb +2 -2
- data/lib/ohai/plugins/aix/memory.rb +2 -2
- data/lib/ohai/plugins/aix/network.rb +9 -10
- data/lib/ohai/plugins/aix/os.rb +2 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -3
- data/lib/ohai/plugins/aix/virtualization.rb +23 -23
- data/lib/ohai/plugins/azure.rb +32 -5
- data/lib/ohai/plugins/bsd/virtualization.rb +22 -22
- data/lib/ohai/plugins/c.rb +3 -3
- data/lib/ohai/plugins/chef.rb +1 -1
- data/lib/ohai/plugins/cloud.rb +59 -60
- data/lib/ohai/plugins/cloud_v2.rb +37 -39
- data/lib/ohai/plugins/darwin/cpu.rb +1 -1
- data/lib/ohai/plugins/darwin/filesystem2.rb +5 -5
- data/lib/ohai/plugins/darwin/memory.rb +5 -6
- data/lib/ohai/plugins/darwin/network.rb +7 -7
- data/lib/ohai/plugins/darwin/system_profiler.rb +32 -33
- data/lib/ohai/plugins/darwin/virtualization.rb +9 -9
- data/lib/ohai/plugins/digital_ocean.rb +16 -16
- data/lib/ohai/plugins/dmi.rb +6 -6
- data/lib/ohai/plugins/dragonflybsd/cpu.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/memory.rb +0 -1
- data/lib/ohai/plugins/dragonflybsd/network.rb +4 -4
- data/lib/ohai/plugins/dragonflybsd/os.rb +1 -1
- data/lib/ohai/plugins/ec2.rb +39 -15
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +3 -3
- data/lib/ohai/plugins/eucalyptus.rb +16 -12
- data/lib/ohai/plugins/freebsd/cpu.rb +2 -2
- data/lib/ohai/plugins/freebsd/memory.rb +0 -1
- data/lib/ohai/plugins/freebsd/network.rb +4 -4
- data/lib/ohai/plugins/freebsd/os.rb +1 -1
- data/lib/ohai/plugins/gce.rb +6 -6
- data/lib/ohai/plugins/hostname.rb +7 -7
- data/lib/ohai/plugins/init_package.rb +1 -1
- data/lib/ohai/plugins/ip_scopes.rb +9 -9
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/joyent.rb +7 -7
- data/lib/ohai/plugins/kernel.rb +8 -8
- data/lib/ohai/plugins/linode.rb +7 -4
- data/lib/ohai/plugins/linux/cpu.rb +5 -5
- data/lib/ohai/plugins/linux/filesystem.rb +16 -16
- data/lib/ohai/plugins/linux/filesystem2.rb +15 -15
- data/lib/ohai/plugins/linux/mdadm.rb +3 -3
- data/lib/ohai/plugins/linux/network.rb +85 -51
- data/lib/ohai/plugins/linux/platform.rb +24 -24
- data/lib/ohai/plugins/linux/virtualization.rb +8 -8
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/netbsd/cpu.rb +1 -1
- data/lib/ohai/plugins/netbsd/network.rb +2 -2
- data/lib/ohai/plugins/network.rb +11 -11
- data/lib/ohai/plugins/network_listeners.rb +30 -26
- data/lib/ohai/plugins/ohai.rb +3 -3
- data/lib/ohai/plugins/openbsd/cpu.rb +4 -4
- data/lib/ohai/plugins/openbsd/memory.rb +4 -4
- data/lib/ohai/plugins/openbsd/network.rb +3 -3
- data/lib/ohai/plugins/openstack.rb +12 -12
- data/lib/ohai/plugins/os.rb +2 -2
- data/lib/ohai/plugins/packages.rb +22 -22
- data/lib/ohai/plugins/passwd.rb +4 -4
- data/lib/ohai/plugins/powershell.rb +9 -9
- data/lib/ohai/plugins/ps.rb +2 -2
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +13 -13
- data/lib/ohai/plugins/root_group.rb +4 -4
- data/lib/ohai/plugins/ruby.rb +6 -6
- data/lib/ohai/plugins/rust.rb +1 -1
- data/lib/ohai/plugins/sigar/cpu.rb +1 -1
- data/lib/ohai/plugins/sigar/filesystem.rb +1 -1
- data/lib/ohai/plugins/sigar/network.rb +13 -13
- data/lib/ohai/plugins/sigar/network_route.rb +34 -29
- data/lib/ohai/plugins/softlayer.rb +8 -7
- data/lib/ohai/plugins/solaris2/cpu.rb +19 -19
- data/lib/ohai/plugins/solaris2/dmi.rb +63 -63
- data/lib/ohai/plugins/solaris2/filesystem.rb +13 -13
- data/lib/ohai/plugins/solaris2/memory.rb +2 -2
- data/lib/ohai/plugins/solaris2/network.rb +5 -5
- data/lib/ohai/plugins/solaris2/virtualization.rb +18 -18
- data/lib/ohai/plugins/solaris2/zpools.rb +1 -1
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +4 -5
- data/lib/ohai/plugins/virtualbox.rb +2 -2
- data/lib/ohai/plugins/virtualization.rb +17 -17
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/cpu.rb +14 -14
- data/lib/ohai/plugins/windows/drivers.rb +8 -8
- data/lib/ohai/plugins/windows/filesystem.rb +4 -4
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +10 -10
- data/lib/ohai/plugins/windows/platform.rb +1 -2
- data/lib/ohai/plugins/windows/virtualization.rb +17 -17
- data/lib/ohai/provides_map.rb +7 -7
- data/lib/ohai/runner.rb +3 -3
- data/lib/ohai/system.rb +21 -20
- data/lib/ohai/util/file_helper.rb +1 -2
- data/lib/ohai/util/ip_helper.rb +4 -4
- data/lib/ohai/util/win32.rb +5 -5
- data/lib/ohai/util/win32/group_helper.rb +4 -5
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +7 -5
- data/spec/functional/application_spec.rb +23 -23
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +13 -13
- data/spec/functional/plugins/root_group_spec.rb +5 -5
- data/spec/ohai_spec.rb +1 -1
- data/spec/spec_helper.rb +9 -9
- data/spec/support/integration_helper.rb +7 -7
- data/spec/support/platform_helpers.rb +1 -1
- data/spec/unit/application_spec.rb +17 -17
- data/spec/unit/config_spec.rb +2 -2
- data/spec/unit/dsl/plugin_spec.rb +28 -28
- data/spec/unit/hints_spec.rb +3 -3
- data/spec/unit/loader_spec.rb +9 -9
- data/spec/unit/mixin/command_spec.rb +5 -5
- data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
- data/spec/unit/mixin/softlayer_metadata_spec.rb +19 -23
- data/spec/unit/plugin_config_spec.rb +5 -5
- data/spec/unit/plugins/abort_spec.rb +3 -3
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +25 -25
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -2
- data/spec/unit/plugins/aix/kernel_spec.rb +3 -3
- data/spec/unit/plugins/aix/memory_spec.rb +8 -8
- data/spec/unit/plugins/aix/network_spec.rb +38 -38
- data/spec/unit/plugins/aix/os_spec.rb +1 -2
- data/spec/unit/plugins/aix/platform_spec.rb +1 -1
- data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +11 -11
- data/spec/unit/plugins/azure_spec.rb +118 -20
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +4 -4
- data/spec/unit/plugins/c_spec.rb +12 -12
- data/spec/unit/plugins/chef_spec.rb +2 -2
- data/spec/unit/plugins/cloud_spec.rb +37 -37
- data/spec/unit/plugins/cloud_v2_spec.rb +64 -65
- data/spec/unit/plugins/darwin/cpu_spec.rb +1 -2
- data/spec/unit/plugins/darwin/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -4
- data/spec/unit/plugins/darwin/kernel_spec.rb +6 -10
- data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
- data/spec/unit/plugins/darwin/network_spec.rb +352 -353
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -2
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +3 -3
- data/spec/unit/plugins/darwin/virtualization_spec.rb +6 -6
- data/spec/unit/plugins/digital_ocean_spec.rb +38 -37
- data/spec/unit/plugins/dmi_spec.rb +3 -3
- data/spec/unit/plugins/ec2_spec.rb +97 -88
- data/spec/unit/plugins/elixir_spec.rb +1 -2
- data/spec/unit/plugins/erlang_spec.rb +2 -2
- data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
- data/spec/unit/plugins/fail_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/cpu_spec.rb +14 -14
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -3
- data/spec/unit/plugins/freebsd/os_spec.rb +4 -5
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/gce_spec.rb +9 -9
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -2
- data/spec/unit/plugins/hostname_spec.rb +1 -2
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/ip_scopes_spec.rb +38 -38
- data/spec/unit/plugins/java_spec.rb +52 -1
- data/spec/unit/plugins/joyent_spec.rb +9 -11
- data/spec/unit/plugins/kernel_spec.rb +11 -12
- data/spec/unit/plugins/linode_spec.rb +29 -29
- data/spec/unit/plugins/linux/block_device_spec.rb +21 -21
- data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
- data/spec/unit/plugins/linux/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/linux/filesystem_spec.rb +85 -86
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -3
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +1 -2
- data/spec/unit/plugins/linux/mdadm_spec.rb +4 -4
- data/spec/unit/plugins/linux/memory_spec.rb +29 -33
- data/spec/unit/plugins/linux/network_spec.rb +463 -245
- data/spec/unit/plugins/linux/platform_spec.rb +64 -65
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -2
- data/spec/unit/plugins/linux/virtualization_spec.rb +42 -42
- data/spec/unit/plugins/lua_spec.rb +1 -2
- data/spec/unit/plugins/mono_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +118 -118
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +1 -1
- data/spec/unit/plugins/ohai_time_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/openstack_spec.rb +35 -37
- data/spec/unit/plugins/os_spec.rb +7 -8
- data/spec/unit/plugins/packages_spec.rb +118 -118
- data/spec/unit/plugins/passwd_spec.rb +18 -18
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +4 -4
- data/spec/unit/plugins/platform_spec.rb +8 -9
- data/spec/unit/plugins/powershell_spec.rb +3 -3
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +66 -68
- data/spec/unit/plugins/root_group_spec.rb +26 -26
- data/spec/unit/plugins/ruby_spec.rb +14 -15
- data/spec/unit/plugins/rust_spec.rb +2 -2
- data/spec/unit/plugins/sigar/network_route_spec.rb +36 -36
- data/spec/unit/plugins/softlayer_spec.rb +10 -10
- data/spec/unit/plugins/solaris2/cpu_spec.rb +20 -21
- data/spec/unit/plugins/solaris2/dmi_spec.rb +5 -6
- data/spec/unit/plugins/solaris2/filesystem.rb +5 -5
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/memory_spec.rb +5 -5
- data/spec/unit/plugins/solaris2/network_spec.rb +7 -8
- data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +3 -5
- data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
- data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +19 -19
- data/spec/unit/plugins/vmware_spec.rb +28 -28
- data/spec/unit/plugins/windows/cpu_spec.rb +46 -48
- data/spec/unit/plugins/windows/memory_spec.rb +5 -5
- data/spec/unit/plugins/windows/virtualization_spec.rb +163 -163
- data/spec/unit/provides_map_spec.rb +10 -10
- data/spec/unit/runner_spec.rb +10 -10
- data/spec/unit/system_spec.rb +19 -19
- data/spec/unit/util/file_helper_spec.rb +5 -6
- data/spec/unit/util/ip_helper_spec.rb +39 -39
- metadata +31 -4
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
2
2
|
|
3
3
|
describe Ohai::System, "plugin etc", :unix_only do
|
4
4
|
before(:each) do
|
@@ -9,42 +9,42 @@ describe Ohai::System, "plugin etc", :unix_only do
|
|
9
9
|
GroupEntry = Struct.new(:name, :gid, :mem)
|
10
10
|
|
11
11
|
it "should include a list of all users" do
|
12
|
-
expect(Etc).to receive(:passwd).and_yield(PasswdEntry.new("root", 1, 1,
|
13
|
-
and_yield(PasswdEntry.new(
|
12
|
+
expect(Etc).to receive(:passwd).and_yield(PasswdEntry.new("root", 1, 1, "/root", "/bin/zsh", "BOFH")).
|
13
|
+
and_yield(PasswdEntry.new("www", 800, 800, "/var/www", "/bin/false", "Serving the web since 1970"))
|
14
14
|
@plugin.run
|
15
|
-
expect(@plugin[:etc][:passwd][
|
16
|
-
expect(@plugin[:etc][:passwd][
|
15
|
+
expect(@plugin[:etc][:passwd]["root"]).to eq(Mash.new(:shell => "/bin/zsh", :gecos => "BOFH", :gid => 1, :uid => 1, :dir => "/root"))
|
16
|
+
expect(@plugin[:etc][:passwd]["www"]).to eq(Mash.new(:shell => "/bin/false", :gecos => "Serving the web since 1970", :gid => 800, :uid => 800, :dir => "/var/www"))
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should ignore duplicate users" do
|
20
|
-
expect(Etc).to receive(:passwd).and_yield(PasswdEntry.new("root", 1, 1,
|
21
|
-
and_yield(PasswdEntry.new(
|
20
|
+
expect(Etc).to receive(:passwd).and_yield(PasswdEntry.new("root", 1, 1, "/root", "/bin/zsh", "BOFH")).
|
21
|
+
and_yield(PasswdEntry.new("root", 1, 1, "/", "/bin/false", "I do not belong"))
|
22
22
|
@plugin.run
|
23
|
-
expect(@plugin[:etc][:passwd][
|
23
|
+
expect(@plugin[:etc][:passwd]["root"]).to eq(Mash.new(:shell => "/bin/zsh", :gecos => "BOFH", :gid => 1, :uid => 1, :dir => "/root"))
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should set the current user" do
|
27
|
-
expect(Process).to receive(:euid).and_return(
|
28
|
-
expect(Etc).to receive(:getpwuid).and_return(PasswdEntry.new(
|
27
|
+
expect(Process).to receive(:euid).and_return("31337")
|
28
|
+
expect(Etc).to receive(:getpwuid).and_return(PasswdEntry.new("chef", 31337, 31337, "/home/chef", "/bin/ksh", "Julia Child"))
|
29
29
|
@plugin.run
|
30
|
-
expect(@plugin[:current_user]).to eq(
|
30
|
+
expect(@plugin[:current_user]).to eq("chef")
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should set the available groups" do
|
34
|
-
expect(Etc).to receive(:group).and_yield(GroupEntry.new("admin", 100,
|
34
|
+
expect(Etc).to receive(:group).and_yield(GroupEntry.new("admin", 100, %w{root chef})).and_yield(GroupEntry.new("www", 800, %w{www deploy}))
|
35
35
|
@plugin.run
|
36
|
-
expect(@plugin[:etc][:group][
|
37
|
-
expect(@plugin[:etc][:group][
|
36
|
+
expect(@plugin[:etc][:group]["admin"]).to eq(Mash.new(:gid => 100, :members => %w{root chef}))
|
37
|
+
expect(@plugin[:etc][:group]["www"]).to eq(Mash.new(:gid => 800, :members => %w{www deploy}))
|
38
38
|
end
|
39
39
|
|
40
40
|
if "".respond_to?(:force_encoding)
|
41
41
|
it "sets the encoding of strings to the default external encoding" do
|
42
|
-
fields = ["root", 1, 1,
|
43
|
-
fields.each {|f| f.force_encoding(Encoding::ASCII_8BIT) if f.respond_to?(:force_encoding) }
|
42
|
+
fields = ["root", 1, 1, "/root", "/bin/zsh", "BOFH"]
|
43
|
+
fields.each { |f| f.force_encoding(Encoding::ASCII_8BIT) if f.respond_to?(:force_encoding) }
|
44
44
|
allow(Etc).to receive(:passwd).and_yield(PasswdEntry.new(*fields))
|
45
45
|
@plugin.run
|
46
|
-
root = @plugin[:etc][:passwd][
|
47
|
-
expect(root[
|
46
|
+
root = @plugin[:etc][:passwd]["root"]
|
47
|
+
expect(root["gecos"].encoding).to eq(Encoding.default_external)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require File.expand_path(File.dirname(__FILE__) +
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
21
21
|
|
22
22
|
describe Ohai::System, "plugin perl" do
|
23
23
|
before(:each) do
|
@@ -18,14 +18,14 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
21
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
|
22
22
|
|
23
23
|
describe Ohai::System, "plugin php" do
|
24
24
|
|
25
25
|
before(:each) do
|
26
26
|
@plugin = get_plugin("php")
|
27
27
|
@plugin[:languages] = Mash.new
|
28
|
-
@stdout =
|
28
|
+
@stdout = <<-OUT
|
29
29
|
PHP 5.1.6 (cli) (built: Jul 16 2008 19:52:52)
|
30
30
|
Copyright (c) 1997-2006 The PHP Group
|
31
31
|
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
|
@@ -55,7 +55,7 @@ OUT
|
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should parse builddate even if it's suhosin patched" do
|
58
|
-
@stdout =
|
58
|
+
@stdout = <<-OUT
|
59
59
|
PHP 5.3.27 with Suhosin-Patch (cli) (built: Aug 30 2013 04:30:30)
|
60
60
|
Copyright (c) 1997-2013 The PHP Group
|
61
61
|
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
|
@@ -66,7 +66,7 @@ OUT
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should not set zend_optcache_version if not compiled with opcache" do
|
69
|
-
@stdout =
|
69
|
+
@stdout = <<-OUT
|
70
70
|
PHP 5.1.6 (cli) (built: Jul 16 2008 19:52:52)
|
71
71
|
Copyright (c) 1997-2006 The PHP Group
|
72
72
|
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
|
@@ -16,15 +16,14 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
20
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
21
20
|
|
22
21
|
describe Ohai::System, "plugin platform" do
|
23
22
|
before(:each) do
|
24
23
|
@plugin = get_plugin("platform")
|
25
24
|
allow(@plugin).to receive(:collect_os).and_return(:default)
|
26
|
-
@plugin[:os] =
|
27
|
-
@plugin[:os_version] =
|
25
|
+
@plugin[:os] = "monkey"
|
26
|
+
@plugin[:os_version] = "poop"
|
28
27
|
end
|
29
28
|
|
30
29
|
it "should set the platform and platform family to the os if it was not set earlier" do
|
@@ -34,20 +33,20 @@ describe Ohai::System, "plugin platform" do
|
|
34
33
|
end
|
35
34
|
|
36
35
|
it "should not set the platform to the os if it was set earlier" do
|
37
|
-
@plugin[:platform] =
|
36
|
+
@plugin[:platform] = "lars"
|
38
37
|
@plugin.run
|
39
38
|
expect(@plugin[:platform]).to eql("lars")
|
40
39
|
end
|
41
40
|
|
42
41
|
it "should set the platform_family to the platform if platform was set earlier but not platform_family" do
|
43
|
-
@plugin[:platform] =
|
44
|
-
@plugin[:platform_family] =
|
42
|
+
@plugin[:platform] = "lars"
|
43
|
+
@plugin[:platform_family] = "jack"
|
45
44
|
@plugin.run
|
46
45
|
expect(@plugin[:platform_family]).to eql("jack")
|
47
46
|
end
|
48
47
|
|
49
48
|
it "should not set the platform_family if the platform_family was set earlier." do
|
50
|
-
@plugin[:platform] =
|
49
|
+
@plugin[:platform] = "lars"
|
51
50
|
@plugin.run
|
52
51
|
expect(@plugin[:platform]).to eql("lars")
|
53
52
|
expect(@plugin[:platform_family]).to eql("lars")
|
@@ -59,7 +58,7 @@ describe Ohai::System, "plugin platform" do
|
|
59
58
|
end
|
60
59
|
|
61
60
|
it "should not set the platform to the os if it was set earlier" do
|
62
|
-
@plugin[:platform_version] =
|
61
|
+
@plugin[:platform_version] = "ulrich"
|
63
62
|
@plugin.run
|
64
63
|
expect(@plugin[:platform_version]).to eql("ulrich")
|
65
64
|
end
|
@@ -15,11 +15,11 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
18
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
|
19
19
|
|
20
20
|
describe Ohai::System, "plugin powershell" do
|
21
21
|
before do
|
22
|
-
stub_const(
|
22
|
+
stub_const("::RbConfig::CONFIG", { "host_os" => "windows" })
|
23
23
|
end
|
24
24
|
|
25
25
|
before(:each) do
|
@@ -50,7 +50,7 @@ END
|
|
50
50
|
expect(@plugin.languages[:powershell][:serialization_version]).to eql("1.1.0.1")
|
51
51
|
expect(@plugin.languages[:powershell][:clr_version]).to eql("4.0.30319.34014")
|
52
52
|
expect(@plugin.languages[:powershell][:build_version]).to eql("6.3.9600.16394")
|
53
|
-
expect(@plugin.languages[:powershell][:compatible_versions]).to eql([
|
53
|
+
expect(@plugin.languages[:powershell][:compatible_versions]).to eql(["1.0", "2.0", "3.0", "4.0"])
|
54
54
|
expect(@plugin.languages[:powershell][:remoting_protocol_version]).to eql("2.2")
|
55
55
|
end
|
56
56
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require File.expand_path(File.dirname(__FILE__) +
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
21
21
|
|
22
22
|
describe Ohai::System, "plugin python" do
|
23
23
|
let(:stdout) { "2.5.2 (r252:60911, Jan 4 2009, 17:40:26)\n[GCC 4.3.2]\n" }
|
@@ -15,53 +15,53 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
18
|
+
require "resolv"
|
19
19
|
|
20
|
-
require File.expand_path(File.dirname(__FILE__) +
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
21
21
|
|
22
22
|
describe Ohai::System, "plugin rackspace" do
|
23
23
|
before(:each) do
|
24
24
|
allow(Resolv).to receive(:getname).and_return("1.2.3.4")
|
25
25
|
@plugin = get_plugin("rackspace")
|
26
26
|
@plugin[:hostname] = "katie"
|
27
|
-
@plugin[:network] = {:interfaces => {:eth0 => {"addresses"=> {
|
28
|
-
"1.2.3.4"=> {
|
29
|
-
"broadcast"=> "67.23.20.255",
|
30
|
-
"netmask"=> "255.255.255.0",
|
31
|
-
"family"=> "inet"
|
27
|
+
@plugin[:network] = { :interfaces => { :eth0 => { "addresses" => {
|
28
|
+
"1.2.3.4" => {
|
29
|
+
"broadcast" => "67.23.20.255",
|
30
|
+
"netmask" => "255.255.255.0",
|
31
|
+
"family" => "inet",
|
32
32
|
},
|
33
|
-
"2a00:1a48:7805:111:e875:efaf:ff08:75"=> {
|
34
|
-
"family"=> "inet6",
|
35
|
-
"prefixlen"=> "64",
|
36
|
-
"scope"=> "Global"
|
33
|
+
"2a00:1a48:7805:111:e875:efaf:ff08:75" => {
|
34
|
+
"family" => "inet6",
|
35
|
+
"prefixlen" => "64",
|
36
|
+
"scope" => "Global",
|
37
37
|
},
|
38
|
-
"fe80::4240:95ff:fe47:6eed"=> {
|
39
|
-
"scope"=> "Link",
|
40
|
-
"prefixlen"=> "64",
|
41
|
-
"family"=> "inet6"
|
38
|
+
"fe80::4240:95ff:fe47:6eed" => {
|
39
|
+
"scope" => "Link",
|
40
|
+
"prefixlen" => "64",
|
41
|
+
"family" => "inet6",
|
42
42
|
},
|
43
|
-
"40:40:95:47:6E:ED"=> {
|
44
|
-
"family"=> "lladdr"
|
45
|
-
}
|
46
|
-
}}
|
43
|
+
"40:40:95:47:6E:ED" => {
|
44
|
+
"family" => "lladdr"
|
45
|
+
},
|
46
|
+
} }
|
47
47
|
}
|
48
48
|
}
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
50
|
+
@plugin[:network][:interfaces][:eth1] = { :addresses => {
|
51
|
+
"fe80::4240:f5ff:feab:2836" => {
|
52
|
+
"scope" => "Link",
|
53
|
+
"prefixlen" => "64",
|
54
|
+
"family" => "inet6",
|
55
|
+
},
|
56
|
+
"5.6.7.8" => {
|
57
|
+
"broadcast" => "10.176.191.255",
|
58
|
+
"netmask" => "255.255.224.0",
|
59
|
+
"family" => "inet",
|
60
|
+
},
|
61
|
+
"40:40:F5:AB:28:36" => {
|
62
|
+
"family" => "lladdr"
|
63
|
+
},
|
64
|
+
} }
|
65
65
|
|
66
66
|
# In olden days we could detect rackspace by a -rscloud suffix on the kernel
|
67
67
|
# This is here to make #has_rackspace_kernel? fail until we remove that check
|
@@ -72,7 +72,7 @@ describe Ohai::System, "plugin rackspace" do
|
|
72
72
|
allow(@plugin).to receive(:shell_out).and_return(mock_shell_out(1, "", ""))
|
73
73
|
end
|
74
74
|
|
75
|
-
shared_examples_for "!rackspace"
|
75
|
+
shared_examples_for "!rackspace" do
|
76
76
|
it "should NOT create rackspace" do
|
77
77
|
@plugin.run
|
78
78
|
expect(@plugin[:rackspace]).to be_nil
|
@@ -119,7 +119,7 @@ describe Ohai::System, "plugin rackspace" do
|
|
119
119
|
expect(@plugin[:rackspace][:public_ipv4]).to eq("1.2.3.4")
|
120
120
|
expect(@plugin[:rackspace][:local_ipv4]).to eq("5.6.7.8")
|
121
121
|
expect(@plugin[:rackspace][:public_ipv6]).to eq("2a00:1a48:7805:111:e875:efaf:ff08:75")
|
122
|
-
expect(@plugin[:rackspace][:local_hostname]).to eq(
|
122
|
+
expect(@plugin[:rackspace][:local_hostname]).to eq("katie")
|
123
123
|
expect(@plugin[:rackspace][:public_hostname]).to eq("1.2.3.4")
|
124
124
|
end
|
125
125
|
|
@@ -149,18 +149,18 @@ OUT
|
|
149
149
|
|
150
150
|
before(:each) do
|
151
151
|
allow(Resolv).to receive(:getname).and_raise(Resolv::ResolvError)
|
152
|
-
allow(File).to receive(:exist?).with(
|
153
|
-
allow(File).to receive(:read).with(
|
152
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/rackspace.json").and_return(true)
|
153
|
+
allow(File).to receive(:read).with("/etc/chef/ohai/hints/rackspace.json").and_return("")
|
154
154
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(true)
|
155
|
-
allow(File).to receive(:read).with('C:\chef\ohai\hints/rackspace.json').and_return(
|
156
|
-
allow(File).to receive(:exist?).with(
|
157
|
-
allow(File).to receive(:read).with(
|
155
|
+
allow(File).to receive(:read).with('C:\chef\ohai\hints/rackspace.json').and_return("")
|
156
|
+
allow(File).to receive(:exist?).with("/etc/resolv.conf").and_return(true)
|
157
|
+
allow(File).to receive(:read).with("/etc/resolv.conf").and_return("")
|
158
158
|
end
|
159
159
|
|
160
|
-
describe
|
160
|
+
describe "with no public interfaces (empty eth0)" do
|
161
161
|
before do
|
162
162
|
# unset public (eth0) addresses
|
163
|
-
@plugin[:network][:interfaces][:eth0][
|
163
|
+
@plugin[:network][:interfaces][:eth0]["addresses"] = {}
|
164
164
|
end
|
165
165
|
|
166
166
|
it "should have all required attributes" do
|
@@ -181,7 +181,7 @@ OUT
|
|
181
181
|
@plugin.run
|
182
182
|
expect(@plugin[:rackspace][:private_ip]).to eq("5.6.7.8")
|
183
183
|
expect(@plugin[:rackspace][:local_ipv4]).to eq("5.6.7.8")
|
184
|
-
expect(@plugin[:rackspace][:local_hostname]).to eq(
|
184
|
+
expect(@plugin[:rackspace][:local_hostname]).to eq("katie")
|
185
185
|
end
|
186
186
|
end
|
187
187
|
end
|
@@ -190,7 +190,7 @@ OUT
|
|
190
190
|
it_should_behave_like "!rackspace"
|
191
191
|
|
192
192
|
before(:each) do
|
193
|
-
allow(File).to receive(:exist?).with(
|
193
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/rackspace.json").and_return(false)
|
194
194
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(false)
|
195
195
|
end
|
196
196
|
end
|
@@ -199,12 +199,12 @@ OUT
|
|
199
199
|
it_should_behave_like "!rackspace"
|
200
200
|
|
201
201
|
before(:each) do
|
202
|
-
allow(File).to receive(:exist?).with(
|
203
|
-
allow(File).to receive(:read).with(
|
202
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/ec2.json").and_return(true)
|
203
|
+
allow(File).to receive(:read).with("/etc/chef/ohai/hints/ec2.json").and_return("")
|
204
204
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/ec2.json').and_return(true)
|
205
|
-
allow(File).to receive(:read).with('C:\chef\ohai\hints/ec2.json').and_return(
|
205
|
+
allow(File).to receive(:read).with('C:\chef\ohai\hints/ec2.json').and_return("")
|
206
206
|
|
207
|
-
allow(File).to receive(:exist?).with(
|
207
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/rackspace.json").and_return(false)
|
208
208
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(false)
|
209
209
|
end
|
210
210
|
end
|
@@ -234,10 +234,10 @@ OUT
|
|
234
234
|
stdout = '{"label": "public", "broadcast": "9.10.11.255", "ips": [{"ip": "9.10.11.12", "netmask": "255.255.255.0", "enabled": "1", "gateway": null}], "mac": "BC:76:4E:20:42:2B", "dns": ["69.20.0.164", "69.20.0.196"], "gateway": null}'
|
235
235
|
allow(@plugin).to receive(:shell_out).with("xenstore-read vm-data/networking/BC764E20422B").and_return(mock_shell_out(0, stdout, "" ))
|
236
236
|
|
237
|
-
allow(File).to receive(:exist?).with(
|
238
|
-
allow(File).to receive(:read).with(
|
237
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/rackspace.json").and_return(true)
|
238
|
+
allow(File).to receive(:read).with("/etc/chef/ohai/hints/rackspace.json").and_return("")
|
239
239
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(true)
|
240
|
-
allow(File).to receive(:read).with('C:\chef\ohai\hints/rackspace.json').and_return(
|
240
|
+
allow(File).to receive(:read).with('C:\chef\ohai\hints/rackspace.json').and_return("")
|
241
241
|
end
|
242
242
|
|
243
243
|
it "should not have private_networks object" do
|
@@ -248,30 +248,30 @@ OUT
|
|
248
248
|
|
249
249
|
describe "has private networks" do
|
250
250
|
before do
|
251
|
-
@plugin[:network][:interfaces][:eth2] = {:addresses => {
|
251
|
+
@plugin[:network][:interfaces][:eth2] = { :addresses => {
|
252
252
|
"fe80::be76:4eff:fe20:422b" => {
|
253
|
-
"scope"=> "Link",
|
254
|
-
"prefixlen"=> "64",
|
255
|
-
"family"=> "inet6"
|
253
|
+
"scope" => "Link",
|
254
|
+
"prefixlen" => "64",
|
255
|
+
"family" => "inet6",
|
256
256
|
},
|
257
|
-
"9.10.11.12"=> {
|
258
|
-
"broadcast"=> "9.10.11.255",
|
259
|
-
"netmask"=> "255.255.255.0",
|
260
|
-
"family"=> "inet"
|
257
|
+
"9.10.11.12" => {
|
258
|
+
"broadcast" => "9.10.11.255",
|
259
|
+
"netmask" => "255.255.255.0",
|
260
|
+
"family" => "inet",
|
261
261
|
},
|
262
262
|
"BC:76:4E:20:42:2B" => {
|
263
|
-
"family"=> "lladdr"
|
264
|
-
}
|
265
|
-
}}
|
263
|
+
"family" => "lladdr"
|
264
|
+
},
|
265
|
+
} }
|
266
266
|
stdout = 'BC764E20422B = "{"label": "private-network"}"\n'
|
267
267
|
allow(@plugin).to receive(:shell_out).with("xenstore-ls vm-data/networking").and_return(mock_shell_out(0, stdout, "" ))
|
268
268
|
stdout = '{"label": "private-network", "broadcast": "9.10.11.255", "ips": [{"ip": "9.10.11.12", "netmask": "255.255.255.0", "enabled": "1", "gateway": null}], "mac": "BC:76:4E:20:42:2B", "dns": ["69.20.0.164", "69.20.0.196"], "gateway": null}'
|
269
269
|
allow(@plugin).to receive(:shell_out).with("xenstore-read vm-data/networking/BC764E20422B").and_return(mock_shell_out(0, stdout, "" ))
|
270
270
|
|
271
|
-
allow(File).to receive(:exist?).with(
|
272
|
-
allow(File).to receive(:read).with(
|
271
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/rackspace.json").and_return(true)
|
272
|
+
allow(File).to receive(:read).with("/etc/chef/ohai/hints/rackspace.json").and_return("")
|
273
273
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(true)
|
274
|
-
allow(File).to receive(:read).with('C:\chef\ohai\hints/rackspace.json').and_return(
|
274
|
+
allow(File).to receive(:read).with('C:\chef\ohai\hints/rackspace.json').and_return("")
|
275
275
|
end
|
276
276
|
|
277
277
|
it "should private_networks object" do
|
@@ -288,6 +288,4 @@ OUT
|
|
288
288
|
|
289
289
|
end
|
290
290
|
|
291
|
-
|
292
|
-
|
293
291
|
end
|
@@ -16,73 +16,73 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.dirname(__FILE__) +
|
20
|
-
require File.expand_path(File.dirname(__FILE__) +
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../lib/ohai/util/win32/group_helper.rb")
|
21
21
|
|
22
|
-
describe Ohai::System,
|
22
|
+
describe Ohai::System, "root_group" do
|
23
23
|
before(:each) do
|
24
24
|
@plugin = get_plugin("root_group")
|
25
25
|
end
|
26
26
|
|
27
|
-
describe
|
27
|
+
describe "unix platform", :unix_only do
|
28
28
|
before(:each) do
|
29
29
|
# this is deeply intertwingled. unfortunately, the law of demeter
|
30
30
|
# apparently didn't apply to this api. we're just trying to fake
|
31
31
|
# Etc.getgrgid(Etc.getpwnam('root').gid).name
|
32
32
|
@pwnam = Object.new
|
33
33
|
allow(@pwnam).to receive(:gid).and_return(0)
|
34
|
-
allow(Etc).to receive(:getpwnam).with(
|
34
|
+
allow(Etc).to receive(:getpwnam).with("root").and_return(@pwnam)
|
35
35
|
@grgid = Object.new
|
36
36
|
allow(Etc).to receive(:getgrgid).and_return(@grgid)
|
37
37
|
end
|
38
38
|
|
39
|
-
describe
|
39
|
+
describe "with wheel group" do
|
40
40
|
before(:each) do
|
41
|
-
allow(@grgid).to receive(:name).and_return(
|
41
|
+
allow(@grgid).to receive(:name).and_return("wheel")
|
42
42
|
end
|
43
|
-
it
|
43
|
+
it "should have a root_group of wheel" do
|
44
44
|
@plugin.run
|
45
|
-
expect(@plugin[:root_group]).to eq(
|
45
|
+
expect(@plugin[:root_group]).to eq("wheel")
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
describe
|
49
|
+
describe "with root group" do
|
50
50
|
before(:each) do
|
51
|
-
allow(@grgid).to receive(:name).and_return(
|
51
|
+
allow(@grgid).to receive(:name).and_return("root")
|
52
52
|
end
|
53
|
-
it
|
53
|
+
it "should have a root_group of root" do
|
54
54
|
@plugin.run
|
55
|
-
expect(@plugin[:root_group]).to eq(
|
55
|
+
expect(@plugin[:root_group]).to eq("root")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
describe
|
59
|
+
describe "platform hpux with sys group" do
|
60
60
|
before(:each) do
|
61
61
|
allow(@pwnam).to receive(:gid).and_return(3)
|
62
|
-
allow(@grgid).to receive(:name).and_return(
|
62
|
+
allow(@grgid).to receive(:name).and_return("sys")
|
63
63
|
end
|
64
|
-
it
|
64
|
+
it "should have a root_group of sys" do
|
65
65
|
@plugin.run
|
66
|
-
expect(@plugin[:root_group]).to eq(
|
66
|
+
expect(@plugin[:root_group]).to eq("sys")
|
67
67
|
end
|
68
68
|
end
|
69
|
-
describe
|
69
|
+
describe "platform aix with system group" do
|
70
70
|
before(:each) do
|
71
|
-
allow(@grgid).to receive(:name).and_return(
|
71
|
+
allow(@grgid).to receive(:name).and_return("system")
|
72
72
|
end
|
73
|
-
it
|
73
|
+
it "should have a root_group of system" do
|
74
74
|
@plugin.run
|
75
|
-
expect(@plugin[:root_group]).to eq(
|
75
|
+
expect(@plugin[:root_group]).to eq("system")
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
describe
|
81
|
-
it
|
82
|
-
stub_const(
|
83
|
-
expect(Ohai::Util::Win32::GroupHelper).to receive(:windows_root_group_name).and_return(
|
80
|
+
describe "windows platform" do
|
81
|
+
it "should return the group administrators" do
|
82
|
+
stub_const("::RbConfig::CONFIG", { "host_os" => "windows" } )
|
83
|
+
expect(Ohai::Util::Win32::GroupHelper).to receive(:windows_root_group_name).and_return("administrators")
|
84
84
|
@plugin.run
|
85
|
-
expect(@plugin[:root_group]).to eq(
|
85
|
+
expect(@plugin[:root_group]).to eq("administrators")
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|