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
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
17
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
|
18
18
|
|
19
19
|
describe Ohai::System, "plugin elixir" do
|
20
20
|
|
@@ -43,4 +43,3 @@ describe Ohai::System, "plugin elixir" do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
46
|
-
|
@@ -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 erlang" do
|
23
23
|
|
@@ -40,7 +40,7 @@ describe Ohai::System, "plugin erlang" do
|
|
40
40
|
|
41
41
|
it "should set languages[:erlang][:options]" do
|
42
42
|
@plugin.run
|
43
|
-
expect(@plugin.languages[:erlang][:options]).to eql(
|
43
|
+
expect(@plugin.languages[:erlang][:options]).to eql(%w{ASYNC_THREADS SMP HIPE})
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should set languages[:erlang][:emulator]" do
|
@@ -17,8 +17,8 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require File.expand_path(File.dirname(__FILE__) +
|
21
|
-
require
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
21
|
+
require "open-uri"
|
22
22
|
|
23
23
|
describe Ohai::System, "plugin eucalyptus" do
|
24
24
|
before(:each) do
|
@@ -58,15 +58,15 @@ describe Ohai::System, "plugin eucalyptus" do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should recursively fetch all the eucalyptus metadata" do
|
61
|
-
allow(IO).to receive(:select).and_return([[],[1],[]])
|
61
|
+
allow(IO).to receive(:select).and_return([[], [1], []])
|
62
62
|
t = double("connection")
|
63
63
|
allow(t).to receive(:connect_nonblock).and_raise(Errno::EINPROGRESS)
|
64
64
|
allow(Socket).to receive(:new).and_return(t)
|
65
65
|
@plugin.run
|
66
66
|
expect(@plugin[:eucalyptus]).not_to be_nil
|
67
|
-
expect(@plugin[:eucalyptus][
|
68
|
-
expect(@plugin[:eucalyptus][
|
69
|
-
expect(@plugin[:eucalyptus][
|
67
|
+
expect(@plugin[:eucalyptus]["instance_type"]).to eq("c1.medium")
|
68
|
+
expect(@plugin[:eucalyptus]["ami_id"]).to eq("ami-5d2dc934")
|
69
|
+
expect(@plugin[:eucalyptus]["security_groups"]).to eql %w{group1 group2}
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -74,8 +74,8 @@ describe Ohai::System, "plugin eucalyptus" do
|
|
74
74
|
it_should_behave_like "eucalyptus"
|
75
75
|
|
76
76
|
before(:each) do
|
77
|
-
allow(IO).to receive(:select).and_return([[],[1],[]])
|
78
|
-
@plugin[:network] = { "interfaces" => { "eth0" => { "addresses" => { "d0:0d:95:47:6E:ED"=> { "family" => "lladdr" } } } } }
|
77
|
+
allow(IO).to receive(:select).and_return([[], [1], []])
|
78
|
+
@plugin[:network] = { "interfaces" => { "eth0" => { "addresses" => { "d0:0d:95:47:6E:ED" => { "family" => "lladdr" } } } } }
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -83,7 +83,7 @@ describe Ohai::System, "plugin eucalyptus" do
|
|
83
83
|
it_should_behave_like "!eucalyptus"
|
84
84
|
|
85
85
|
before(:each) do
|
86
|
-
@plugin[:network] = { "interfaces" => { "eth0" => { "addresses" => { "ff:ff:95:47:6E:ED"=> { "family" => "lladdr" } } } } }
|
86
|
+
@plugin[:network] = { "interfaces" => { "eth0" => { "addresses" => { "ff:ff:95:47:6E:ED" => { "family" => "lladdr" } } } } }
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -91,10 +91,10 @@ describe Ohai::System, "plugin eucalyptus" do
|
|
91
91
|
it_should_behave_like "eucalyptus"
|
92
92
|
|
93
93
|
before(:each) do
|
94
|
-
allow(File).to receive(:exist?).with(
|
95
|
-
allow(File).to receive(:read).with(
|
94
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/eucalyptus.json").and_return(true)
|
95
|
+
allow(File).to receive(:read).with("/etc/chef/ohai/hints/eucalyptus.json").and_return("")
|
96
96
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/eucalyptus.json').and_return(true)
|
97
|
-
allow(File).to receive(:read).with('C:\chef\ohai\hints/eucalyptus.json').and_return(
|
97
|
+
allow(File).to receive(:read).with('C:\chef\ohai\hints/eucalyptus.json').and_return("")
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -102,8 +102,8 @@ describe Ohai::System, "plugin eucalyptus" do
|
|
102
102
|
it_should_behave_like "!eucalyptus"
|
103
103
|
|
104
104
|
before(:each) do
|
105
|
-
@plugin[:network] = {:interfaces => {}}
|
106
|
-
allow(File).to receive(:exist?).with(
|
105
|
+
@plugin[:network] = { :interfaces => {} }
|
106
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/eucalyptus.json").and_return(false)
|
107
107
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/eucalyptus.json').and_return(false)
|
108
108
|
end
|
109
109
|
end
|
@@ -112,14 +112,14 @@ describe Ohai::System, "plugin eucalyptus" do
|
|
112
112
|
it_should_behave_like "!eucalyptus"
|
113
113
|
|
114
114
|
before(:each) do
|
115
|
-
@plugin[:network] = {:interfaces => {}}
|
115
|
+
@plugin[:network] = { :interfaces => {} }
|
116
116
|
|
117
|
-
allow(File).to receive(:exist?).with(
|
117
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/eucalyptus.json").and_return(false)
|
118
118
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/eucalyptus.json').and_return(false)
|
119
119
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/ec2.json').and_return(true)
|
120
|
-
allow(File).to receive(:exist?).with(
|
121
|
-
allow(File).to receive(:read).with(
|
122
|
-
allow(File).to receive(:read).with('C:\chef\ohai\hints/ec2.json').and_return(
|
120
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/ec2.json").and_return(true)
|
121
|
+
allow(File).to receive(:read).with("/etc/chef/ohai/hints/ec2.json").and_return("")
|
122
|
+
allow(File).to receive(:read).with('C:\chef\ohai\hints/ec2.json').and_return("")
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -17,9 +17,9 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
20
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
|
21
21
|
|
22
|
-
tmp = ENV[
|
22
|
+
tmp = ENV["TMPDIR"] || ENV["TMP"] || ENV["TEMP"] || "/tmp"
|
23
23
|
|
24
24
|
shared_examples "a v7 loading failure" do
|
25
25
|
before(:all) do
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.dirname(__FILE__) +
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
20
20
|
|
21
21
|
describe Ohai::System, "FreeBSD cpu plugin on FreeBSD >=10.2" do
|
22
22
|
before(:each) do
|
@@ -24,20 +24,20 @@ describe Ohai::System, "FreeBSD cpu plugin on FreeBSD >=10.2" do
|
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:freebsd)
|
25
25
|
@double_file = double("/var/run/dmesg.boot")
|
26
26
|
allow(@double_file).to receive(:each).
|
27
|
-
and_yield(
|
27
|
+
and_yield("CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz (2793.59-MHz K8-class CPU)").
|
28
28
|
and_yield(' Origin="GenuineIntel" Id=0x40661 Family=0x6 Model=0x46 Stepping=1').
|
29
|
-
and_yield(
|
30
|
-
and_yield(
|
31
|
-
and_yield(
|
32
|
-
and_yield(
|
33
|
-
and_yield(
|
34
|
-
and_yield(
|
35
|
-
and_yield(
|
36
|
-
and_yield(
|
29
|
+
and_yield(" Features=0x783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>").
|
30
|
+
and_yield(" Features2=0x5ed8220b<SSE3,PCLMULQDQ,MON,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,RDRAND>").
|
31
|
+
and_yield(" AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>").
|
32
|
+
and_yield(" AMD Features2=0x21<LAHF,ABM>").
|
33
|
+
and_yield(" Structured Extended Features=0x2000<NFPUSG>").
|
34
|
+
and_yield(" TSC: P-state invariant").
|
35
|
+
and_yield("real memory = 1073676288 (1023 MB)").
|
36
|
+
and_yield("avail memory = 1010253824 (963 MB)").
|
37
37
|
and_yield('Event timer "LAPIC" quality 400').
|
38
|
-
and_yield(
|
39
|
-
and_yield(
|
40
|
-
and_yield(
|
38
|
+
and_yield("ACPI APIC Table: <VBOX VBOXAPIC>").
|
39
|
+
and_yield("FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs").
|
40
|
+
and_yield("FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 SMT threads")
|
41
41
|
allow(File).to receive(:open).with("/var/run/dmesg.boot").and_return(@double_file)
|
42
42
|
end
|
43
43
|
|
@@ -100,7 +100,7 @@ describe Ohai::System, "FreeBSD cpu plugin on FreeBSD <=10.1" do
|
|
100
100
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.ncpu").and_return(mock_shell_out(0, "2", ""))
|
101
101
|
@double_file = double("/var/run/dmesg.boot")
|
102
102
|
allow(@double_file).to receive(:each).
|
103
|
-
and_yield(
|
103
|
+
and_yield("CPU: Intel(R) Atom(TM) CPU N270 @ 1.60GHz (1596.03-MHz 686-class CPU)").
|
104
104
|
and_yield(' Origin = "GenuineIntel" Id = 0x106c2 Family = 0x6 Model = 0x1c Stepping = 2')
|
105
105
|
allow(File).to receive(:open).with("/var/run/dmesg.boot").and_return(@double_file)
|
106
106
|
end
|
@@ -16,8 +16,7 @@
|
|
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, "FreeBSD hostname plugin" do
|
23
22
|
before(:each) do
|
@@ -16,14 +16,13 @@
|
|
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, "FreeBSD kernel plugin" do
|
23
22
|
before(:each) do
|
24
23
|
@plugin = get_plugin("kernel")
|
25
24
|
allow(@plugin).to receive(:collect_os).and_return(:freebsd)
|
26
|
-
allow(@plugin).to receive(:init_kernel).and_return({:name => "freebsd"})
|
25
|
+
allow(@plugin).to receive(:init_kernel).and_return({ :name => "freebsd" })
|
27
26
|
allow(@plugin).to receive(:shell_out).with("uname -i").and_return(mock_shell_out(0, "foo\n", ""))
|
28
27
|
allow(@plugin).to receive(:shell_out).with("sysctl kern.securelevel").and_return(mock_shell_out(0, "kern.securelevel: 1", ""))
|
29
28
|
allow(@plugin).to receive(:shell_out).with( Ohai.abs_path( "/sbin/kldstat" )).and_return(mock_shell_out(0, " 1 7 0xc0400000 97f830 kernel", ""))
|
@@ -6,9 +6,9 @@
|
|
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.
|
@@ -16,8 +16,7 @@
|
|
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, "FreeBSD plugin os" do
|
23
22
|
before(:each) do
|
@@ -30,4 +29,4 @@ describe Ohai::System, "FreeBSD plugin os" do
|
|
30
29
|
@plugin.run
|
31
30
|
expect(@plugin[:os_version]).to eq("902001")
|
32
31
|
end
|
33
|
-
end
|
32
|
+
end
|
@@ -16,8 +16,7 @@
|
|
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, "FreeBSD plugin platform" do
|
23
22
|
before(:each) do
|
@@ -15,8 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require File.expand_path(File.dirname(__FILE__) +
|
19
|
-
require
|
18
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
19
|
+
require "open-uri"
|
20
20
|
|
21
21
|
describe Ohai::System, "plugin gce" do
|
22
22
|
before(:each) do
|
@@ -34,7 +34,7 @@ describe Ohai::System, "plugin gce" do
|
|
34
34
|
before(:each) do
|
35
35
|
@http_client = double("Net::HTTP client")
|
36
36
|
allow(@plugin).to receive(:http_client).and_return(@http_client)
|
37
|
-
allow(IO).to receive(:select).and_return([[],[1],[]])
|
37
|
+
allow(IO).to receive(:select).and_return([[], [1], []])
|
38
38
|
t = double("connection")
|
39
39
|
allow(t).to receive(:connect_nonblock).and_raise(Errno::EINPROGRESS)
|
40
40
|
allow(Socket).to receive(:new).and_return(t)
|
@@ -44,12 +44,12 @@ describe Ohai::System, "plugin gce" do
|
|
44
44
|
it "should recursively fetch and properly parse json metadata" do
|
45
45
|
expect(@http_client).to receive(:get).
|
46
46
|
with("/computeMetadata/v1beta1/?recursive=true/").
|
47
|
-
and_return(double("Net::HTTP Response", :body => '{"instance":{"hostname":"test-host"}}', :code=>"200"))
|
47
|
+
and_return(double("Net::HTTP Response", :body => '{"instance":{"hostname":"test-host"}}', :code => "200"))
|
48
48
|
|
49
49
|
@plugin.run
|
50
50
|
|
51
51
|
expect(@plugin[:gce]).not_to be_nil
|
52
|
-
expect(@plugin[:gce][
|
52
|
+
expect(@plugin[:gce]["instance"]).to eq("hostname" => "test-host")
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
@@ -58,10 +58,10 @@ describe Ohai::System, "plugin gce" do
|
|
58
58
|
it_should_behave_like "gce"
|
59
59
|
|
60
60
|
before(:each) do
|
61
|
-
allow(File).to receive(:exist?).with(
|
62
|
-
allow(File).to receive(:read).with(
|
61
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/gce.json").and_return(true)
|
62
|
+
allow(File).to receive(:read).with("/etc/chef/ohai/hints/gce.json").and_return("")
|
63
63
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/gce.json').and_return(true)
|
64
|
-
allow(File).to receive(:read).with('C:\chef\ohai\hints/gce.json').and_return(
|
64
|
+
allow(File).to receive(:read).with('C:\chef\ohai\hints/gce.json').and_return("")
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -69,7 +69,7 @@ describe Ohai::System, "plugin gce" do
|
|
69
69
|
it_should_behave_like "!gce"
|
70
70
|
|
71
71
|
before(:each) do
|
72
|
-
allow(File).to receive(:exist?).with(
|
72
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/gce.json").and_return(false)
|
73
73
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/gce.json').and_return(false)
|
74
74
|
|
75
75
|
# Raise Errno::ENOENT to simulate the scenario in which metadata server
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
16
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
|
17
17
|
|
18
18
|
describe Ohai::System, "plugin go" do
|
19
19
|
|
@@ -16,8 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
20
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_helper.rb'))
|
19
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
|
21
20
|
|
22
21
|
describe Ohai::System, "plugin groovy" do
|
23
22
|
|
@@ -16,8 +16,7 @@
|
|
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, "hostname plugin" do
|
23
22
|
before(:each) do
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
19
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "/spec_helper.rb"))
|
20
20
|
|
21
21
|
describe Ohai::System, "Init package" do
|
22
22
|
let(:plugin) {
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
2
2
|
|
3
3
|
begin
|
4
|
-
require
|
4
|
+
require "ipaddr_extensions"
|
5
5
|
rescue LoadError
|
6
6
|
end
|
7
7
|
|
8
8
|
describe Ohai::System, "plugin ip_scopes" do
|
9
|
-
let(:plugin) { get_plugin(
|
9
|
+
let(:plugin) { get_plugin("ip_scopes") }
|
10
10
|
let(:network) { Mash.new(:interfaces => interfaces) }
|
11
11
|
let(:interfaces) { Hash[
|
12
12
|
interface1, { :addresses => addresses1, :type => interface1_type },
|
@@ -15,59 +15,59 @@ describe Ohai::System, "plugin ip_scopes" do
|
|
15
15
|
let(:interface2) { :eth1 }
|
16
16
|
let(:addresses1) { {} }
|
17
17
|
let(:addresses2) { {} }
|
18
|
-
let(:interface1_type) {
|
19
|
-
let(:interface2_type) {
|
18
|
+
let(:interface1_type) { "eth" }
|
19
|
+
let(:interface2_type) { "eth" }
|
20
20
|
|
21
21
|
before { plugin[:network] = network }
|
22
22
|
|
23
23
|
if defined?(IPAddrExtensions)
|
24
|
-
context
|
25
|
-
let(:ip1) {
|
26
|
-
let(:ip2) {
|
27
|
-
let(:ip3) {
|
24
|
+
context "with ipaddr_extensions gem" do
|
25
|
+
let(:ip1) { "10.0.0.1" }
|
26
|
+
let(:ip2) { "1.2.3.4" }
|
27
|
+
let(:ip3) { "fe80::8638:35ff:fe4e:dc74" }
|
28
28
|
|
29
29
|
let(:addresses1) { Hash[ip1, {}] }
|
30
30
|
let(:addresses2) { Hash[ip2, {}, ip3, {}] }
|
31
31
|
|
32
32
|
it "adds ip_scope to each address's information hash" do
|
33
33
|
plugin.run
|
34
|
-
expect(plugin[:network][:interfaces][:eth0][:addresses][
|
35
|
-
expect(plugin[:network][:interfaces][:eth1][:addresses][
|
36
|
-
expect(plugin[:network][:interfaces][:eth1][:addresses][
|
34
|
+
expect(plugin[:network][:interfaces][:eth0][:addresses]["10.0.0.1"][:ip_scope]).to eq("RFC1918 PRIVATE")
|
35
|
+
expect(plugin[:network][:interfaces][:eth1][:addresses]["1.2.3.4"][:ip_scope]).to eq("GLOBAL UNICAST")
|
36
|
+
expect(plugin[:network][:interfaces][:eth1][:addresses]["fe80::8638:35ff:fe4e:dc74"][:ip_scope]).to eq("LINK LOCAL UNICAST")
|
37
37
|
end
|
38
38
|
|
39
|
-
describe
|
39
|
+
describe "privateaddress attribute" do
|
40
40
|
before { plugin.run }
|
41
41
|
|
42
|
-
context
|
43
|
-
let(:ip1) {
|
44
|
-
let(:ip2) {
|
45
|
-
let(:interface1_type) {
|
46
|
-
let(:interface2_type) {
|
42
|
+
context "when host has multiple RFC1918 ethernet addresses" do
|
43
|
+
let(:ip1) { "10.0.0.1" }
|
44
|
+
let(:ip2) { "192.168.1.1" }
|
45
|
+
let(:interface1_type) { "eth" }
|
46
|
+
let(:interface2_type) { "eth" }
|
47
47
|
|
48
|
-
it
|
49
|
-
expect(plugin[:privateaddress]).to eq(
|
48
|
+
it "picks the last RFC1918 address" do
|
49
|
+
expect(plugin[:privateaddress]).to eq("192.168.1.1")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
context
|
54
|
-
let(:ip1) {
|
55
|
-
let(:ip2) {
|
56
|
-
let(:interface1_type) {
|
57
|
-
let(:interface2_type) {
|
53
|
+
context "when host has virtual and ethernet RFC1918 addresses" do
|
54
|
+
let(:ip1) { "10.0.0.1" }
|
55
|
+
let(:ip2) { "192.168.1.1" }
|
56
|
+
let(:interface1_type) { "eth" }
|
57
|
+
let(:interface2_type) { "ppp" }
|
58
58
|
|
59
|
-
it
|
60
|
-
expect(plugin[:privateaddress]).to eq(
|
59
|
+
it "picks the non-virtual address" do
|
60
|
+
expect(plugin[:privateaddress]).to eq("10.0.0.1")
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
context
|
65
|
-
let(:ip1) {
|
66
|
-
let(:ip2) {
|
67
|
-
let(:interface1_type) {
|
68
|
-
let(:interface2_type) {
|
64
|
+
context "when host only has virtual RFC1918 addresses" do
|
65
|
+
let(:ip1) { "10.0.0.1" }
|
66
|
+
let(:ip2) { "192.168.1.1" }
|
67
|
+
let(:interface1_type) { "ppp" }
|
68
|
+
let(:interface2_type) { "ppp" }
|
69
69
|
|
70
|
-
it
|
70
|
+
it "ignores them" do
|
71
71
|
expect(plugin[:privateaddress]).to be nil
|
72
72
|
end
|
73
73
|
end
|
@@ -76,8 +76,8 @@ describe Ohai::System, "plugin ip_scopes" do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
unless defined?(IPAddrExtensions)
|
79
|
-
context
|
80
|
-
let(:addresses1) { Hash[
|
79
|
+
context "without the ipaddr_extensions gem" do
|
80
|
+
let(:addresses1) { Hash["10.0.0.1", {}] }
|
81
81
|
|
82
82
|
before do
|
83
83
|
# standin for raising on `require 'ipaddr_extensions'`
|
@@ -85,11 +85,11 @@ describe Ohai::System, "plugin ip_scopes" do
|
|
85
85
|
plugin.run
|
86
86
|
end
|
87
87
|
|
88
|
-
it
|
89
|
-
expect(plugin[:network][:interfaces][:eth0][:addresses][
|
88
|
+
it "does not add ip_scope to addresses" do
|
89
|
+
expect(plugin[:network][:interfaces][:eth0][:addresses]["10.0.0.1"][:ip_scope]).to be nil
|
90
90
|
end
|
91
91
|
|
92
|
-
it
|
92
|
+
it "does not add a privateaddress attribute" do
|
93
93
|
expect(plugin[:privateaddress]).to be nil
|
94
94
|
end
|
95
95
|
end
|