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
@@ -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, "BSD filesystem plugin" do
|
23
23
|
let(:plugin) { get_plugin("bsd/filesystem") }
|
@@ -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, "BSD virtualization plugin" do
|
22
22
|
before(:each) do
|
@@ -24,7 +24,7 @@ describe Ohai::System, "BSD virtualization plugin" do
|
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:freebsd)
|
25
25
|
allow(@plugin).to receive(:shell_out).with("sysctl -n security.jail.jailed").and_return(mock_shell_out(0, "0", ""))
|
26
26
|
allow(@plugin).to receive(:shell_out).with("#{ Ohai.abs_path( "/sbin/kldstat" )}").and_return(mock_shell_out(0, "", ""))
|
27
|
-
allow(@plugin).to receive(:shell_out).with("jls -n").and_return(mock_shell_out(0, "",""))
|
27
|
+
allow(@plugin).to receive(:shell_out).with("jls -n").and_return(mock_shell_out(0, "", ""))
|
28
28
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.model").and_return(mock_shell_out(0, "", ""))
|
29
29
|
end
|
30
30
|
|
@@ -39,7 +39,7 @@ describe Ohai::System, "BSD virtualization plugin" do
|
|
39
39
|
|
40
40
|
it "detects we are hosting jails" do
|
41
41
|
# from http://www.freebsd.org/doc/handbook/jails-application.html
|
42
|
-
|
42
|
+
@jails = "JID IP Address Hostname Path\n 3 192.168.3.17 ns.example.org /home/j/ns\n 2 192.168.3.18 mail.example.org /home/j/mail\n 1 62.123.43.14 www.example.org /home/j/www"
|
43
43
|
allow(@plugin).to receive(:shell_out).with("jls -n").and_return(mock_shell_out(0, @jails, ""))
|
44
44
|
@plugin.run
|
45
45
|
expect(@plugin[:virtualization][:system]).to eq("jail")
|
@@ -86,7 +86,7 @@ OUT
|
|
86
86
|
|
87
87
|
context "when on a QEMU guest" do
|
88
88
|
it "detects we are a guest" do
|
89
|
-
[
|
89
|
+
[ "Common KVM processor", 'QEMU Virtual CPU version (cpu64-rhel6) ("GenuineIntel" 686-class)', "Common 32-bit KVM processor"].each do |kvm_string|
|
90
90
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.model").and_return(mock_shell_out(0, kvm_string, ""))
|
91
91
|
@plugin.run
|
92
92
|
expect(@plugin[:virtualization][:system]).to eq("kvm")
|
data/spec/unit/plugins/c_spec.rb
CHANGED
@@ -16,9 +16,9 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require
|
19
|
+
require "rbconfig"
|
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
|
C_GCC = <<EOF
|
24
24
|
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
|
@@ -42,7 +42,7 @@ Available extensions:
|
|
42
42
|
The C stubs add-on version 2.1.2.
|
43
43
|
BIND-8.2.3-T5B
|
44
44
|
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
|
45
|
-
Glibc-2.0 compatibility add-on by Cristian Gafton
|
45
|
+
Glibc-2.0 compatibility add-on by Cristian Gafton
|
46
46
|
GNU Libidn by Simon Josefsson
|
47
47
|
libthread_db work sponsored by Alpha Processor Inc
|
48
48
|
Thread-local storage support included.
|
@@ -59,14 +59,14 @@ PARTICULAR PURPOSE.
|
|
59
59
|
Compiled by GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-44).
|
60
60
|
Compiled on a Linux 2.6.9 system on 2009-09-02.
|
61
61
|
Available extensions:
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
62
|
+
The C stubs add-on version 2.1.2.
|
63
|
+
crypt add-on version 2.1 by Michael Glad and others
|
64
|
+
GNU Libidn by Simon Josefsson
|
65
|
+
GNU libio by Per Bothner
|
66
|
+
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
|
67
|
+
Native POSIX Threads Library by Ulrich Drepper et al
|
68
|
+
BIND-8.2.3-T5B
|
69
|
+
RT using linux kernel aio
|
70
70
|
Thread-local storage support included.
|
71
71
|
For bug reporting instructions, please see:
|
72
72
|
<http://www.gnu.org/software/libc/bugs.html>.
|
@@ -97,7 +97,7 @@ C_HPUX = <<EOF
|
|
97
97
|
$Revision: 92453-07 linker linker crt0.o B.11.47 051104 $
|
98
98
|
LINT B.11.11.16 CXREF B.11.11.16
|
99
99
|
HP92453-01 B.11.11.16 HP C Compiler
|
100
|
-
$ PATCH/11.00:PHCO_27774 Oct 3 2002 09:45:59 $
|
100
|
+
$ PATCH/11.00:PHCO_27774 Oct 3 2002 09:45:59 $
|
101
101
|
EOF
|
102
102
|
|
103
103
|
describe Ohai::System, "plugin c" do
|
@@ -19,9 +19,9 @@
|
|
19
19
|
#
|
20
20
|
|
21
21
|
begin
|
22
|
-
require File.expand_path(File.dirname(__FILE__) +
|
22
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
23
23
|
|
24
|
-
require
|
24
|
+
require "chef/version"
|
25
25
|
|
26
26
|
describe Ohai::System, "plugin chef" do
|
27
27
|
before(:each) do
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require File.expand_path(File.dirname(__FILE__) +
|
18
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
19
19
|
|
20
20
|
describe Ohai::System, "plugin cloud" do
|
21
21
|
before(:each) do
|
@@ -41,15 +41,15 @@ describe Ohai::System, "plugin cloud" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "populates cloud public ip" do
|
44
|
-
@plugin[:ec2][
|
44
|
+
@plugin[:ec2]["public_ipv4"] = "174.129.150.8"
|
45
45
|
@plugin.run
|
46
|
-
expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:ec2][
|
46
|
+
expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:ec2]["public_ipv4"])
|
47
47
|
end
|
48
48
|
|
49
49
|
it "populates cloud private ip" do
|
50
|
-
@plugin[:ec2][
|
50
|
+
@plugin[:ec2]["local_ipv4"] = "10.252.42.149"
|
51
51
|
@plugin.run
|
52
|
-
expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:ec2][
|
52
|
+
expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:ec2]["local_ipv4"])
|
53
53
|
end
|
54
54
|
|
55
55
|
it "populates cloud provider" do
|
@@ -111,19 +111,19 @@ describe Ohai::System, "plugin cloud" do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
it "populates cloud public ip" do
|
114
|
-
@plugin[:linode][
|
114
|
+
@plugin[:linode]["public_ip"] = "174.129.150.8"
|
115
115
|
@plugin.run
|
116
116
|
expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:linode][:public_ip])
|
117
117
|
end
|
118
118
|
|
119
119
|
it "populates cloud private ip" do
|
120
|
-
@plugin[:linode][
|
120
|
+
@plugin[:linode]["private_ip"] = "10.252.42.149"
|
121
121
|
@plugin.run
|
122
122
|
expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:linode][:private_ip])
|
123
123
|
end
|
124
124
|
|
125
125
|
it "populates first cloud public ip" do
|
126
|
-
@plugin[:linode][
|
126
|
+
@plugin[:linode]["public_ip"] = "174.129.150.8"
|
127
127
|
@plugin.run
|
128
128
|
expect(@plugin[:cloud][:public_ips].first).to eq(@plugin[:linode][:public_ip])
|
129
129
|
end
|
@@ -140,15 +140,15 @@ describe Ohai::System, "plugin cloud" do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
it "populates cloud public ip" do
|
143
|
-
@plugin[:eucalyptus][
|
143
|
+
@plugin[:eucalyptus]["public_ipv4"] = "174.129.150.8"
|
144
144
|
@plugin.run
|
145
|
-
expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:eucalyptus][
|
145
|
+
expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:eucalyptus]["public_ipv4"])
|
146
146
|
end
|
147
147
|
|
148
148
|
it "populates cloud private ip" do
|
149
|
-
@plugin[:eucalyptus][
|
149
|
+
@plugin[:eucalyptus]["local_ipv4"] = "10.252.42.149"
|
150
150
|
@plugin.run
|
151
|
-
expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:eucalyptus][
|
151
|
+
expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:eucalyptus]["local_ipv4"])
|
152
152
|
end
|
153
153
|
|
154
154
|
it "populates cloud provider" do
|
@@ -163,41 +163,41 @@ describe Ohai::System, "plugin cloud" do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
it "populates cloud public ip" do
|
166
|
-
@plugin[:azure][
|
166
|
+
@plugin[:azure]["public_ip"] = "174.129.150.8"
|
167
167
|
@plugin.run
|
168
|
-
expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:azure][
|
169
|
-
expect(@plugin[:cloud][:public_ipv4]).to eq(@plugin[:azure][
|
168
|
+
expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:azure]["public_ip"])
|
169
|
+
expect(@plugin[:cloud][:public_ipv4]).to eq(@plugin[:azure]["public_ip"])
|
170
170
|
end
|
171
171
|
|
172
172
|
it "populates cloud vm_name" do
|
173
|
-
@plugin[:azure][
|
173
|
+
@plugin[:azure]["vm_name"] = "linux-vm"
|
174
174
|
@plugin.run
|
175
|
-
expect(@plugin[:cloud][:vm_name]).to eq(@plugin[:azure][
|
175
|
+
expect(@plugin[:cloud][:vm_name]).to eq(@plugin[:azure]["vm_name"])
|
176
176
|
end
|
177
177
|
|
178
178
|
it "populates cloud public_fqdn" do
|
179
|
-
@plugin[:azure][
|
179
|
+
@plugin[:azure]["public_fqdn"] = "linux-vm-svc.cloudapp.net"
|
180
180
|
@plugin.run
|
181
|
-
expect(@plugin[:cloud][:public_fqdn]).to eq(@plugin[:azure][
|
182
|
-
expect(@plugin[:cloud][:public_hostname]).to eq(@plugin[:azure][
|
181
|
+
expect(@plugin[:cloud][:public_fqdn]).to eq(@plugin[:azure]["public_fqdn"])
|
182
|
+
expect(@plugin[:cloud][:public_hostname]).to eq(@plugin[:azure]["public_fqdn"])
|
183
183
|
end
|
184
184
|
|
185
185
|
it "populates cloud public_ssh_port" do
|
186
|
-
@plugin[:azure][
|
186
|
+
@plugin[:azure]["public_ssh_port"] = "22"
|
187
187
|
@plugin.run
|
188
|
-
expect(@plugin[:cloud][:public_ssh_port]).to eq(@plugin[:azure][
|
188
|
+
expect(@plugin[:cloud][:public_ssh_port]).to eq(@plugin[:azure]["public_ssh_port"])
|
189
189
|
end
|
190
190
|
|
191
191
|
it "should not populate cloud public_ssh_port when winrm is used" do
|
192
|
-
@plugin[:azure][
|
192
|
+
@plugin[:azure]["public_winrm_port"] = "5985"
|
193
193
|
@plugin.run
|
194
194
|
expect(@plugin[:cloud][:public_ssh_port]).to be_nil
|
195
195
|
end
|
196
196
|
|
197
197
|
it "populates cloud public_winrm_port" do
|
198
|
-
@plugin[:azure][
|
198
|
+
@plugin[:azure]["public_winrm_port"] = "5985"
|
199
199
|
@plugin.run
|
200
|
-
expect(@plugin[:cloud][:public_winrm_port]).to eq(@plugin[:azure][
|
200
|
+
expect(@plugin[:cloud][:public_winrm_port]).to eq(@plugin[:azure]["public_winrm_port"])
|
201
201
|
end
|
202
202
|
|
203
203
|
it "populates cloud provider" do
|
@@ -211,10 +211,10 @@ describe Ohai::System, "plugin cloud" do
|
|
211
211
|
@plugin[:digital_ocean] = Mash.new
|
212
212
|
@plugin[:digital_ocean][:name] = "public.example.com"
|
213
213
|
@plugin[:digital_ocean][:networks] = Mash.new
|
214
|
-
@plugin[:digital_ocean][:networks][:v4] = [{"ip_address" => "1.2.3.4", "type" => "public"},
|
215
|
-
{"ip_address" => "5.6.7.8", "type" => "private"}]
|
216
|
-
@plugin[:digital_ocean][:networks][:v6] = [{"ip_address" => "fe80::4240:95ff:fe47:6eee", "type" => "public"},
|
217
|
-
{"ip_address" => "fdf8:f53b:82e4::53", "type" => "private"}]
|
214
|
+
@plugin[:digital_ocean][:networks][:v4] = [{ "ip_address" => "1.2.3.4", "type" => "public" },
|
215
|
+
{ "ip_address" => "5.6.7.8", "type" => "private" }]
|
216
|
+
@plugin[:digital_ocean][:networks][:v6] = [{ "ip_address" => "fe80::4240:95ff:fe47:6eee", "type" => "public" },
|
217
|
+
{ "ip_address" => "fdf8:f53b:82e4::53", "type" => "private" }]
|
218
218
|
end
|
219
219
|
|
220
220
|
before(:each) do
|
@@ -230,29 +230,29 @@ describe Ohai::System, "plugin cloud" do
|
|
230
230
|
end
|
231
231
|
|
232
232
|
it "populates cloud public ips" do
|
233
|
-
expect(@plugin[:cloud][:public_ips]).to eq(@plugin[:digital_ocean][:networks][:v4].select{|ip| ip[
|
234
|
-
@plugin[:digital_ocean][:networks][:v6].select{|ip| ip[
|
233
|
+
expect(@plugin[:cloud][:public_ips]).to eq(@plugin[:digital_ocean][:networks][:v4].select { |ip| ip["type"] == "public" } +
|
234
|
+
@plugin[:digital_ocean][:networks][:v6].select { |ip| ip["type"] == "public" })
|
235
235
|
end
|
236
236
|
|
237
237
|
it "populates cloud private ips" do
|
238
|
-
expect(@plugin[:cloud][:private_ips]).to eq(@plugin[:digital_ocean][:networks][:v4].select{|ip| ip[
|
239
|
-
@plugin[:digital_ocean][:networks][:v6].select{|ip| ip[
|
238
|
+
expect(@plugin[:cloud][:private_ips]).to eq(@plugin[:digital_ocean][:networks][:v4].select { |ip| ip["type"] == "private" } +
|
239
|
+
@plugin[:digital_ocean][:networks][:v6].select { |ip| ip["type"] == "private" })
|
240
240
|
end
|
241
241
|
|
242
242
|
it "populates cloud public_ipv4" do
|
243
|
-
expect(@plugin[:cloud][:public_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find{|ip| ip[
|
243
|
+
expect(@plugin[:cloud][:public_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find { |ip| ip["type"] == "public" })
|
244
244
|
end
|
245
245
|
|
246
246
|
it "populates cloud local_ipv4" do
|
247
|
-
expect(@plugin[:cloud][:local_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find{|ip| ip[
|
247
|
+
expect(@plugin[:cloud][:local_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find { |ip| ip["type"] == "private" })
|
248
248
|
end
|
249
249
|
|
250
250
|
it "populates cloud public_ipv6" do
|
251
|
-
expect(@plugin[:cloud][:public_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find{|ip| ip[
|
251
|
+
expect(@plugin[:cloud][:public_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find { |ip| ip["type"] == "public" })
|
252
252
|
end
|
253
253
|
|
254
254
|
it "populates cloud local_ipv6" do
|
255
|
-
expect(@plugin[:cloud][:local_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find{|ip| ip[
|
255
|
+
expect(@plugin[:cloud][:local_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find { |ip| ip["type"] == "private" })
|
256
256
|
end
|
257
257
|
|
258
258
|
it "populates cloud provider" 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 "ipaddr"
|
20
20
|
|
21
21
|
describe "CloudAttrs object" do
|
22
22
|
before(:each) do
|
@@ -24,17 +24,17 @@ describe "CloudAttrs object" do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
let(:cloud_node) do
|
27
|
-
{"public_ipv4_addrs"=>["1.2.3.1"],
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
{ "public_ipv4_addrs" => ["1.2.3.1"],
|
28
|
+
"local_ipv4_addrs" => ["1.2.4.1"],
|
29
|
+
"public_ipv6_addrs" => ["3ffe:505:2::1"],
|
30
|
+
"local_ipv6_addrs" => ["3ffe:506:2::1"],
|
31
|
+
"public_ipv4" => "1.2.3.1",
|
32
|
+
"local_ipv4" => "1.2.4.1",
|
33
|
+
"public_ipv6" => "3ffe:505:2::1",
|
34
|
+
"local_ipv6" => "3ffe:506:2::1",
|
35
|
+
"public_hostname" => "myhost.somewhere.com",
|
36
|
+
"local_hostname" => "my-localhost",
|
37
|
+
"provider" => "my_awesome_cloud",
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
@@ -52,17 +52,17 @@ describe "CloudAttrs object" do
|
|
52
52
|
|
53
53
|
it "throws exception with a bad ipv4 address" do
|
54
54
|
@cloud_attr_obj = ::CloudAttrs.new()
|
55
|
-
expect {
|
55
|
+
expect { @cloud_attr_obj.add_ipv6_addr("somebogusstring", :public) }.to raise_error(RuntimeError)
|
56
56
|
end
|
57
57
|
|
58
58
|
it "throws exception with a bad ipv6 address" do
|
59
59
|
@cloud_attr_obj = ::CloudAttrs.new()
|
60
|
-
expect {
|
60
|
+
expect { @cloud_attr_obj.add_ipv6_addr("FEED:B0B:DEAD:BEEF", :public) }.to raise_error(RuntimeError)
|
61
61
|
end
|
62
62
|
|
63
63
|
it "throws exception with ipv6 address passed to ipv4" do
|
64
64
|
@cloud_attr_obj = ::CloudAttrs.new()
|
65
|
-
expect {
|
65
|
+
expect { @cloud_attr_obj.add_ipv4_addr("3ffe:506:2::1", :public) }.to raise_error(RuntimeError)
|
66
66
|
end
|
67
67
|
|
68
68
|
it "throws exception with ipv4 address passed to ipv6" do
|
@@ -70,7 +70,6 @@ describe "CloudAttrs object" do
|
|
70
70
|
expect { @cloud_attr_obj.add_ipv6_addr("1.2.3.4", :public) }.to raise_error(RuntimeError)
|
71
71
|
end
|
72
72
|
|
73
|
-
|
74
73
|
end
|
75
74
|
|
76
75
|
describe Ohai::System, "plugin cloud" do
|
@@ -98,15 +97,15 @@ describe Ohai::System, "plugin cloud" do
|
|
98
97
|
end
|
99
98
|
|
100
99
|
it "populates cloud public ip" do
|
101
|
-
@plugin[:ec2][
|
100
|
+
@plugin[:ec2]["public_ipv4"] = "174.129.150.8"
|
102
101
|
@plugin.run
|
103
|
-
expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:ec2][
|
102
|
+
expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:ec2]["public_ipv4"])
|
104
103
|
end
|
105
104
|
|
106
105
|
it "populates cloud private ip" do
|
107
|
-
@plugin[:ec2][
|
106
|
+
@plugin[:ec2]["local_ipv4"] = "10.252.42.149"
|
108
107
|
@plugin.run
|
109
|
-
expect(@plugin[:cloud_v2][:local_ipv4_addrs][0]).to eq(@plugin[:ec2][
|
108
|
+
expect(@plugin[:cloud_v2][:local_ipv4_addrs][0]).to eq(@plugin[:ec2]["local_ipv4"])
|
110
109
|
end
|
111
110
|
|
112
111
|
it "populates cloud provider" do
|
@@ -119,13 +118,13 @@ describe Ohai::System, "plugin cloud" do
|
|
119
118
|
describe "with a public IP" do
|
120
119
|
before do
|
121
120
|
@plugin[:gce] = Mash.new()
|
122
|
-
@plugin[:gce][
|
123
|
-
@plugin[:gce][
|
121
|
+
@plugin[:gce]["instance"] = Mash.new()
|
122
|
+
@plugin[:gce]["instance"]["networkInterfaces"] = [
|
124
123
|
{
|
125
|
-
"accessConfigs" => [ {"externalIp" => "8.35.198.173", "type"=>"ONE_TO_ONE_NAT"} ],
|
124
|
+
"accessConfigs" => [ { "externalIp" => "8.35.198.173", "type" => "ONE_TO_ONE_NAT" } ],
|
126
125
|
"ip" => "10.240.0.102",
|
127
|
-
"network"=> "projects/foo/networks/default"
|
128
|
-
}
|
126
|
+
"network" => "projects/foo/networks/default",
|
127
|
+
},
|
129
128
|
]
|
130
129
|
end
|
131
130
|
|
@@ -148,13 +147,13 @@ describe Ohai::System, "plugin cloud" do
|
|
148
147
|
describe "with no public IP" do
|
149
148
|
before do
|
150
149
|
@plugin[:gce] = Mash.new()
|
151
|
-
@plugin[:gce][
|
152
|
-
@plugin[:gce][
|
150
|
+
@plugin[:gce]["instance"] = Mash.new()
|
151
|
+
@plugin[:gce]["instance"]["networkInterfaces"] = [
|
153
152
|
{
|
154
|
-
"accessConfigs" => [ {"externalIp" => "", "type" => "ONE_TO_ONE_NAT"} ],
|
153
|
+
"accessConfigs" => [ { "externalIp" => "", "type" => "ONE_TO_ONE_NAT" } ],
|
155
154
|
"ip" => "10.240.0.102",
|
156
|
-
"network" => "projects/foo/networks/default"
|
157
|
-
}
|
155
|
+
"network" => "projects/foo/networks/default",
|
156
|
+
},
|
158
157
|
]
|
159
158
|
end
|
160
159
|
|
@@ -228,19 +227,19 @@ describe Ohai::System, "plugin cloud" do
|
|
228
227
|
end
|
229
228
|
|
230
229
|
it "populates cloud public ip" do
|
231
|
-
@plugin[:linode][
|
230
|
+
@plugin[:linode]["public_ip"] = "174.129.150.8"
|
232
231
|
@plugin.run
|
233
232
|
expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:linode][:public_ip])
|
234
233
|
end
|
235
234
|
|
236
235
|
it "populates cloud private ip" do
|
237
|
-
@plugin[:linode][
|
236
|
+
@plugin[:linode]["private_ip"] = "10.252.42.149"
|
238
237
|
@plugin.run
|
239
238
|
expect(@plugin[:cloud_v2][:local_ipv4_addrs][0]).to eq(@plugin[:linode][:private_ip])
|
240
239
|
end
|
241
240
|
|
242
241
|
it "populates first cloud public ip" do
|
243
|
-
@plugin[:linode][
|
242
|
+
@plugin[:linode]["public_ip"] = "174.129.150.8"
|
244
243
|
@plugin.run
|
245
244
|
expect(@plugin[:cloud_v2][:public_ipv4_addrs].first).to eq(@plugin[:linode][:public_ip])
|
246
245
|
end
|
@@ -257,15 +256,15 @@ describe Ohai::System, "plugin cloud" do
|
|
257
256
|
end
|
258
257
|
|
259
258
|
it "populates cloud public ip" do
|
260
|
-
@plugin[:eucalyptus][
|
259
|
+
@plugin[:eucalyptus]["public_ipv4"] = "174.129.150.8"
|
261
260
|
@plugin.run
|
262
|
-
expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:eucalyptus][
|
261
|
+
expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:eucalyptus]["public_ipv4"])
|
263
262
|
end
|
264
263
|
|
265
264
|
it "populates cloud private ip" do
|
266
|
-
@plugin[:eucalyptus][
|
265
|
+
@plugin[:eucalyptus]["local_ipv4"] = "10.252.42.149"
|
267
266
|
@plugin.run
|
268
|
-
expect(@plugin[:cloud_v2][:local_ipv4_addrs][0]).to eq(@plugin[:eucalyptus][
|
267
|
+
expect(@plugin[:cloud_v2][:local_ipv4_addrs][0]).to eq(@plugin[:eucalyptus]["local_ipv4"])
|
269
268
|
end
|
270
269
|
|
271
270
|
it "populates cloud provider" do
|
@@ -280,37 +279,37 @@ describe Ohai::System, "plugin cloud" do
|
|
280
279
|
end
|
281
280
|
|
282
281
|
it "populates cloud public ip" do
|
283
|
-
@plugin[:azure][
|
282
|
+
@plugin[:azure]["public_ip"] = "174.129.150.8"
|
284
283
|
@plugin.run
|
285
|
-
expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:azure][
|
284
|
+
expect(@plugin[:cloud_v2][:public_ipv4_addrs][0]).to eq(@plugin[:azure]["public_ip"])
|
286
285
|
end
|
287
286
|
|
288
287
|
it "doesn't populates cloud vm_name" do
|
289
|
-
@plugin[:azure][
|
288
|
+
@plugin[:azure]["vm_name"] = "linux-vm"
|
290
289
|
@plugin.run
|
291
|
-
expect(@plugin[:cloud_v2][:vm_name]).not_to eq(@plugin[:azure][
|
290
|
+
expect(@plugin[:cloud_v2][:vm_name]).not_to eq(@plugin[:azure]["vm_name"])
|
292
291
|
end
|
293
292
|
|
294
293
|
it "populates cloud public_hostname" do
|
295
|
-
@plugin[:azure][
|
294
|
+
@plugin[:azure]["public_fqdn"] = "linux-vm-svc.cloudapp.net"
|
296
295
|
@plugin.run
|
297
|
-
expect(@plugin[:cloud_v2][:public_hostname]).to eq(@plugin[:azure][
|
296
|
+
expect(@plugin[:cloud_v2][:public_hostname]).to eq(@plugin[:azure]["public_fqdn"])
|
298
297
|
end
|
299
298
|
|
300
299
|
it "doesn't populate cloud public_ssh_port" do
|
301
|
-
@plugin[:azure][
|
300
|
+
@plugin[:azure]["public_ssh_port"] = "22"
|
302
301
|
@plugin.run
|
303
302
|
expect(@plugin[:cloud_v2][:public_ssh_port]).to be_nil
|
304
303
|
end
|
305
304
|
|
306
305
|
it "should not populate cloud public_ssh_port when winrm is used" do
|
307
|
-
@plugin[:azure][
|
306
|
+
@plugin[:azure]["public_winrm_port"] = "5985"
|
308
307
|
@plugin.run
|
309
308
|
expect(@plugin[:cloud_v2][:public_ssh_port]).to be_nil
|
310
309
|
end
|
311
310
|
|
312
311
|
it "populates cloud public_winrm_port" do
|
313
|
-
@plugin[:azure][
|
312
|
+
@plugin[:azure]["public_winrm_port"] = "5985"
|
314
313
|
@plugin.run
|
315
314
|
expect(@plugin[:cloud_v2][:public_winrm_port]).to be_nil
|
316
315
|
end
|
@@ -326,10 +325,10 @@ describe Ohai::System, "plugin cloud" do
|
|
326
325
|
@plugin[:digital_ocean] = Mash.new
|
327
326
|
@plugin[:digital_ocean][:name] = "public.example.com"
|
328
327
|
@plugin[:digital_ocean][:networks] = Mash.new
|
329
|
-
@plugin[:digital_ocean][:networks][:v4] = [{"ip_address" => "1.2.3.4", "type" => "public"},
|
330
|
-
{"ip_address" => "5.6.7.8", "type" => "private"}]
|
331
|
-
@plugin[:digital_ocean][:networks][:v6] = [{"ip_address" => "fe80::4240:95ff:fe47:6eee", "type" => "public"},
|
332
|
-
{"ip_address" => "fdf8:f53b:82e4::53", "type" => "private"}]
|
328
|
+
@plugin[:digital_ocean][:networks][:v4] = [{ "ip_address" => "1.2.3.4", "type" => "public" },
|
329
|
+
{ "ip_address" => "5.6.7.8", "type" => "private" }]
|
330
|
+
@plugin[:digital_ocean][:networks][:v6] = [{ "ip_address" => "fe80::4240:95ff:fe47:6eee", "type" => "public" },
|
331
|
+
{ "ip_address" => "fdf8:f53b:82e4::53", "type" => "private" }]
|
333
332
|
end
|
334
333
|
|
335
334
|
before(:each) do
|
@@ -345,41 +344,41 @@ describe Ohai::System, "plugin cloud" do
|
|
345
344
|
end
|
346
345
|
|
347
346
|
it "populates cloud public_ipv4_addrs" do
|
348
|
-
expect(@plugin[:cloud_v2][:public_ipv4_addrs]).to eq(@plugin[:digital_ocean][:networks][:v4].select{|ip| ip[
|
349
|
-
.map{|ip| ip[
|
350
|
-
|
347
|
+
expect(@plugin[:cloud_v2][:public_ipv4_addrs]).to eq(@plugin[:digital_ocean][:networks][:v4].select { |ip| ip["type"] == "public" }
|
348
|
+
.map { |ip| ip["ip_address"] })
|
349
|
+
|
351
350
|
end
|
352
351
|
|
353
352
|
it "populates cloud local_ipv4_addrs" do
|
354
|
-
expect(@plugin[:cloud_v2][:local_ipv4_addrs]).to eq(@plugin[:digital_ocean][:networks][:v4].select{|ip| ip[
|
355
|
-
.map{|ip| ip[
|
356
|
-
|
353
|
+
expect(@plugin[:cloud_v2][:local_ipv4_addrs]).to eq(@plugin[:digital_ocean][:networks][:v4].select { |ip| ip["type"] == "private" }
|
354
|
+
.map { |ip| ip["ip_address"] })
|
355
|
+
|
357
356
|
end
|
358
357
|
|
359
358
|
it "populates cloud public_ipv4" do
|
360
|
-
expect(@plugin[:cloud_v2][:public_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find{|ip| ip[
|
359
|
+
expect(@plugin[:cloud_v2][:public_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find { |ip| ip["type"] == "public" }["ip_address"])
|
361
360
|
end
|
362
361
|
|
363
362
|
it "populates cloud local_ipv4" do
|
364
|
-
expect(@plugin[:cloud_v2][:local_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find{|ip| ip[
|
363
|
+
expect(@plugin[:cloud_v2][:local_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find { |ip| ip["type"] == "private" }["ip_address"])
|
365
364
|
end
|
366
365
|
|
367
366
|
it "populates cloud public_ipv6_addrs" do
|
368
|
-
expect(@plugin[:cloud_v2][:public_ipv6_addrs]).to eq(@plugin[:digital_ocean][:networks][:v6].select{|ip| ip[
|
369
|
-
.map{|ip| ip[
|
367
|
+
expect(@plugin[:cloud_v2][:public_ipv6_addrs]).to eq(@plugin[:digital_ocean][:networks][:v6].select { |ip| ip["type"] == "public" }
|
368
|
+
.map { |ip| ip["ip_address"] })
|
370
369
|
end
|
371
370
|
|
372
371
|
it "populates cloud local_ipv6_addrs" do
|
373
|
-
expect(@plugin[:cloud_v2][:local_ipv6_addrs]).to eq(@plugin[:digital_ocean][:networks][:v6].select{|ip| ip[
|
374
|
-
.map{|ip| ip[
|
372
|
+
expect(@plugin[:cloud_v2][:local_ipv6_addrs]).to eq(@plugin[:digital_ocean][:networks][:v6].select { |ip| ip["type"] == "private" }
|
373
|
+
.map { |ip| ip["ip_address"] })
|
375
374
|
end
|
376
375
|
|
377
376
|
it "populates cloud public_ipv6" do
|
378
|
-
expect(@plugin[:cloud_v2][:public_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find{|ip| ip[
|
377
|
+
expect(@plugin[:cloud_v2][:public_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find { |ip| ip["type"] == "public" }["ip_address"])
|
379
378
|
end
|
380
379
|
|
381
380
|
it "populates cloud local_ipv6" do
|
382
|
-
expect(@plugin[:cloud_v2][:local_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find{|ip| ip[
|
381
|
+
expect(@plugin[:cloud_v2][:local_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find { |ip| ip["type"] == "private" }["ip_address"])
|
383
382
|
end
|
384
383
|
|
385
384
|
it "populates cloud provider" do
|