ohai 15.3.1 → 15.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -6
- data/lib/ohai/mixin/{network_constants.rb → network_helper.rb} +8 -1
- data/lib/ohai/plugins/aix/network.rb +3 -8
- data/lib/ohai/plugins/darwin/network.rb +6 -4
- data/lib/ohai/plugins/filesystem.rb +166 -0
- data/lib/ohai/plugins/network.rb +5 -5
- data/lib/ohai/plugins/openstack.rb +2 -1
- data/lib/ohai/plugins/solaris2/network.rb +6 -4
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +1 -1
- metadata +3 -162
- data/Rakefile +0 -42
- data/lib/ohai/plugins/windows/filesystem.rb +0 -147
- data/spec/data/plugins/dpkg-query.output +0 -4
- data/spec/data/plugins/lslpp.output +0 -50
- data/spec/data/plugins/pacman.output +0 -51
- data/spec/data/plugins/pkg-query.output +0 -58
- data/spec/data/plugins/pkginfo.output +0 -50
- data/spec/data/plugins/pkglist.output +0 -24
- data/spec/data/plugins/rpmquery.output +0 -7
- data/spec/functional/application_spec.rb +0 -107
- data/spec/functional/loader_spec.rb +0 -53
- data/spec/functional/plugins/powershell_spec.rb +0 -88
- data/spec/functional/plugins/root_group_spec.rb +0 -41
- data/spec/functional/plugins/windows/uptime_spec.rb +0 -51
- data/spec/ohai_spec.rb +0 -27
- data/spec/rcov.opts +0 -2
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -124
- data/spec/support/integration_helper.rb +0 -61
- data/spec/support/platform_helpers.rb +0 -38
- data/spec/unit/application_spec.rb +0 -96
- data/spec/unit/config_spec.rb +0 -57
- data/spec/unit/dsl/plugin_spec.rb +0 -634
- data/spec/unit/hints_spec.rb +0 -65
- data/spec/unit/loader_spec.rb +0 -195
- data/spec/unit/mixin/azure_metadata_spec.rb +0 -72
- data/spec/unit/mixin/command_spec.rb +0 -151
- data/spec/unit/mixin/dmi_decode.rb +0 -75
- data/spec/unit/mixin/ec2_metadata_spec.rb +0 -88
- data/spec/unit/mixin/softlayer_metadata_spec.rb +0 -72
- data/spec/unit/plugin_config_spec.rb +0 -117
- data/spec/unit/plugins/abort_spec.rb +0 -69
- data/spec/unit/plugins/aix/cpu_spec.rb +0 -127
- data/spec/unit/plugins/aix/filesystem_spec.rb +0 -238
- data/spec/unit/plugins/aix/hostname_spec.rb +0 -33
- data/spec/unit/plugins/aix/kernel_spec.rb +0 -61
- data/spec/unit/plugins/aix/memory_spec.rb +0 -49
- data/spec/unit/plugins/aix/network_spec.rb +0 -313
- data/spec/unit/plugins/aix/platform_spec.rb +0 -44
- data/spec/unit/plugins/aix/uptime_spec.rb +0 -42
- data/spec/unit/plugins/aix/virtualization_spec.rb +0 -319
- data/spec/unit/plugins/azure_spec.rb +0 -243
- data/spec/unit/plugins/bsd/filesystem_spec.rb +0 -138
- data/spec/unit/plugins/bsd/virtualization_spec.rb +0 -145
- data/spec/unit/plugins/c_spec.rb +0 -341
- data/spec/unit/plugins/chef_spec.rb +0 -44
- data/spec/unit/plugins/cloud_spec.rb +0 -484
- data/spec/unit/plugins/darwin/cpu_spec.rb +0 -124
- data/spec/unit/plugins/darwin/filesystem_spec.rb +0 -140
- data/spec/unit/plugins/darwin/hardware_spec.rb +0 -105
- data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +0 -1110
- data/spec/unit/plugins/darwin/hostname_spec.rb +0 -43
- data/spec/unit/plugins/darwin/kernel_spec.rb +0 -65
- data/spec/unit/plugins/darwin/memory_spec.rb +0 -64
- data/spec/unit/plugins/darwin/network_spec.rb +0 -849
- data/spec/unit/plugins/darwin/platform_spec.rb +0 -71
- data/spec/unit/plugins/darwin/virtualization_spec.rb +0 -156
- data/spec/unit/plugins/digital_ocean_spec.rb +0 -106
- data/spec/unit/plugins/dmi_spec.rb +0 -156
- data/spec/unit/plugins/docker_spec.rb +0 -100
- data/spec/unit/plugins/ec2_spec.rb +0 -452
- data/spec/unit/plugins/elixir_spec.rb +0 -55
- data/spec/unit/plugins/erlang_spec.rb +0 -71
- data/spec/unit/plugins/eucalyptus_spec.rb +0 -109
- data/spec/unit/plugins/fail_spec.rb +0 -260
- data/spec/unit/plugins/freebsd/cpu_spec.rb +0 -129
- data/spec/unit/plugins/freebsd/hostname_spec.rb +0 -35
- data/spec/unit/plugins/freebsd/kernel_spec.rb +0 -36
- data/spec/unit/plugins/freebsd/platform_spec.rb +0 -38
- data/spec/unit/plugins/gce_spec.rb +0 -81
- data/spec/unit/plugins/go_spec.rb +0 -48
- data/spec/unit/plugins/groovy_spec.rb +0 -66
- data/spec/unit/plugins/haskell_spec.rb +0 -231
- data/spec/unit/plugins/hostname_spec.rb +0 -162
- data/spec/unit/plugins/init_package_spec.rb +0 -60
- data/spec/unit/plugins/java_spec.rb +0 -230
- data/spec/unit/plugins/joyent_spec.rb +0 -100
- data/spec/unit/plugins/kernel_spec.rb +0 -38
- data/spec/unit/plugins/linode_spec.rb +0 -135
- data/spec/unit/plugins/linux/block_device_spec.rb +0 -75
- data/spec/unit/plugins/linux/cpu_spec.rb +0 -441
- data/spec/unit/plugins/linux/filesystem_spec.rb +0 -550
- data/spec/unit/plugins/linux/fips_spec.rb +0 -60
- data/spec/unit/plugins/linux/hostname_spec.rb +0 -52
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +0 -59
- data/spec/unit/plugins/linux/kernel_spec.rb +0 -71
- data/spec/unit/plugins/linux/lsb_spec.rb +0 -147
- data/spec/unit/plugins/linux/lspci_spec.rb +0 -133
- data/spec/unit/plugins/linux/machineid_spec.rb +0 -46
- data/spec/unit/plugins/linux/mdadm_spec.rb +0 -170
- data/spec/unit/plugins/linux/memory_spec.rb +0 -256
- data/spec/unit/plugins/linux/network_spec.rb +0 -1392
- data/spec/unit/plugins/linux/platform_spec.rb +0 -812
- data/spec/unit/plugins/linux/sessions_spec.rb +0 -98
- data/spec/unit/plugins/linux/sysctl_spec.rb +0 -53
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +0 -122
- data/spec/unit/plugins/linux/uptime_spec.rb +0 -48
- data/spec/unit/plugins/linux/virtualization_spec.rb +0 -650
- data/spec/unit/plugins/lua_spec.rb +0 -60
- data/spec/unit/plugins/mono_spec.rb +0 -67
- data/spec/unit/plugins/netbsd/hostname_spec.rb +0 -43
- data/spec/unit/plugins/netbsd/kernel_spec.rb +0 -35
- data/spec/unit/plugins/netbsd/platform_spec.rb +0 -38
- data/spec/unit/plugins/network_spec.rb +0 -1078
- data/spec/unit/plugins/nodejs_spec.rb +0 -55
- data/spec/unit/plugins/ohai_spec.rb +0 -32
- data/spec/unit/plugins/ohai_time_spec.rb +0 -44
- data/spec/unit/plugins/openbsd/hostname_spec.rb +0 -43
- data/spec/unit/plugins/openbsd/kernel_spec.rb +0 -36
- data/spec/unit/plugins/openbsd/platform_spec.rb +0 -33
- data/spec/unit/plugins/openstack_spec.rb +0 -311
- data/spec/unit/plugins/os_spec.rb +0 -115
- data/spec/unit/plugins/packages_spec.rb +0 -353
- data/spec/unit/plugins/passwd_spec.rb +0 -65
- data/spec/unit/plugins/perl_spec.rb +0 -62
- data/spec/unit/plugins/php_spec.rb +0 -97
- data/spec/unit/plugins/platform_spec.rb +0 -65
- data/spec/unit/plugins/powershell_spec.rb +0 -71
- data/spec/unit/plugins/python_spec.rb +0 -51
- data/spec/unit/plugins/rackspace_spec.rb +0 -350
- data/spec/unit/plugins/root_group_spec.rb +0 -90
- data/spec/unit/plugins/ruby_spec.rb +0 -60
- data/spec/unit/plugins/rust_spec.rb +0 -43
- data/spec/unit/plugins/scala_spec.rb +0 -58
- data/spec/unit/plugins/scaleway_spec.rb +0 -93
- data/spec/unit/plugins/scsi_spec.rb +0 -69
- data/spec/unit/plugins/shard_spec.rb +0 -121
- data/spec/unit/plugins/shells_spec.rb +0 -56
- data/spec/unit/plugins/softlayer_spec.rb +0 -60
- data/spec/unit/plugins/solaris2/cpu_spec.rb +0 -2926
- data/spec/unit/plugins/solaris2/dmi_spec.rb +0 -153
- data/spec/unit/plugins/solaris2/filesystem.rb +0 -407
- data/spec/unit/plugins/solaris2/hostname_spec.rb +0 -37
- data/spec/unit/plugins/solaris2/kernel_spec.rb +0 -183
- data/spec/unit/plugins/solaris2/memory_spec.rb +0 -43
- data/spec/unit/plugins/solaris2/network_spec.rb +0 -201
- data/spec/unit/plugins/solaris2/platform_spec.rb +0 -108
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +0 -97
- data/spec/unit/plugins/ssh_host_keys_spec.rb +0 -116
- data/spec/unit/plugins/sysconf_spec.rb +0 -680
- data/spec/unit/plugins/timezone_spec.rb +0 -30
- data/spec/unit/plugins/vbox_host_spec.rb +0 -14
- data/spec/unit/plugins/virtualbox_spec.rb +0 -375
- data/spec/unit/plugins/vmware_spec.rb +0 -81
- data/spec/unit/plugins/windows/cpu_spec.rb +0 -118
- data/spec/unit/plugins/windows/filesystem_spec.rb +0 -226
- data/spec/unit/plugins/windows/fips_spec.rb +0 -60
- data/spec/unit/plugins/windows/kernel_spec.rb +0 -79
- data/spec/unit/plugins/windows/memory_spec.rb +0 -52
- data/spec/unit/plugins/windows/network_spec.rb +0 -137
- data/spec/unit/plugins/windows/system_enclosure_spec.rb +0 -45
- data/spec/unit/plugins/windows/uptime_spec.rb +0 -38
- data/spec/unit/plugins/windows/virtualization_spec.rb +0 -63
- data/spec/unit/plugins/zpools_spec.rb +0 -244
- data/spec/unit/provides_map_spec.rb +0 -208
- data/spec/unit/runner_spec.rb +0 -422
- data/spec/unit/system_spec.rb +0 -416
- data/spec/unit/util/file_helper_spec.rb +0 -47
- data/spec/unit/util/ip_helper_spec.rb +0 -128
@@ -1,44 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
5
|
-
# License:: Apache License, Version 2.0
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
|
19
|
-
require "spec_helper"
|
20
|
-
|
21
|
-
describe Ohai::System, "Aix plugin platform" do
|
22
|
-
before do
|
23
|
-
@plugin = get_plugin("aix/platform")
|
24
|
-
allow(@plugin).to receive(:collect_os).and_return(:aix)
|
25
|
-
kernel = Mash.new
|
26
|
-
kernel[:name] = "aix"
|
27
|
-
kernel[:version] = "7"
|
28
|
-
kernel[:release] = "1"
|
29
|
-
allow(@plugin).to receive(:kernel).and_return(kernel)
|
30
|
-
@plugin.run
|
31
|
-
end
|
32
|
-
|
33
|
-
it "sets platform to aix" do
|
34
|
-
expect(@plugin[:platform]).to eq("aix")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "sets the platform_version" do
|
38
|
-
expect(@plugin[:platform_version]).to eq("7.1")
|
39
|
-
end
|
40
|
-
|
41
|
-
it "sets platform_family" do
|
42
|
-
expect(@plugin[:platform_family]).to eq(@plugin[:platform])
|
43
|
-
end
|
44
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
5
|
-
# License:: Apache License, Version 2.0
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
require "spec_helper"
|
20
|
-
|
21
|
-
describe Ohai::System, "Aix plugin uptime" do
|
22
|
-
|
23
|
-
before do
|
24
|
-
@plugin = get_plugin("aix/uptime")
|
25
|
-
allow(@plugin).to receive(:collect_os).and_return(:aix)
|
26
|
-
allow(@plugin).to receive(:shell_out).and_call_original
|
27
|
-
end
|
28
|
-
|
29
|
-
it "sets uptime_seconds and uptime standard case" do
|
30
|
-
allow(@plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0, "1148-20:54:50", nil))
|
31
|
-
@plugin.run
|
32
|
-
expect(@plugin[:uptime_seconds]).to eq(99262490)
|
33
|
-
expect(@plugin[:uptime]).to eq("1148 days 20 hours 54 minutes 50 seconds")
|
34
|
-
end
|
35
|
-
|
36
|
-
it "sets uptime_seconds and uptime in the whitespace case" do
|
37
|
-
allow(@plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0, " 2-20:54:50", nil))
|
38
|
-
@plugin.run
|
39
|
-
expect(@plugin[:uptime_seconds]).to eq(248090)
|
40
|
-
expect(@plugin[:uptime]).to eq("2 days 20 hours 54 minutes 50 seconds")
|
41
|
-
end
|
42
|
-
end
|
@@ -1,319 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Julian C. Dunn (<jdunn@chef.iom>)
|
3
|
-
# Author:: Isa Farnik (<isa@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
|
5
|
-
# License:: Apache License, Version 2.0
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
|
19
|
-
require "spec_helper"
|
20
|
-
|
21
|
-
describe Ohai::System, "AIX virtualization plugin" do
|
22
|
-
|
23
|
-
context "inside an LPAR" do
|
24
|
-
|
25
|
-
let(:plugin) do
|
26
|
-
p = get_plugin("aix/virtualization")
|
27
|
-
allow(p).to receive(:collect_os).and_return(:aix)
|
28
|
-
allow(p).to receive(:shell_out).with("uname -L").and_return(mock_shell_out(0, "29 l273pp027", nil))
|
29
|
-
allow(p).to receive(:shell_out).with("uname -W").and_return(mock_shell_out(0, "0", nil))
|
30
|
-
allow(p).to receive(:shell_out).with("lswpar -L").and_return(mock_shell_out(0, @lswpar_l, nil))
|
31
|
-
p
|
32
|
-
end
|
33
|
-
|
34
|
-
before do
|
35
|
-
@lswpar_l = <<~LSWPAR_L
|
36
|
-
=================================================================
|
37
|
-
applejack-541ba3 - Active
|
38
|
-
=================================================================
|
39
|
-
GENERAL
|
40
|
-
Type: S
|
41
|
-
RootVG WPAR: no
|
42
|
-
Owner: root
|
43
|
-
Hostname: applejack-pony-541ba3.ponyville.com
|
44
|
-
WPAR-Specific Routing: yes
|
45
|
-
Virtual IP WPAR:
|
46
|
-
Directory: /wpars/applejack-541ba3
|
47
|
-
Start/Stop Script:
|
48
|
-
Auto: no
|
49
|
-
Private /usr: yes
|
50
|
-
Checkpointable: no
|
51
|
-
Application:
|
52
|
-
UUID: 541ba314-c7ca-4f67-bc6e-a10d5eaa8541
|
53
|
-
|
54
|
-
NETWORK
|
55
|
-
Interface Address(6) Mask/Prefix Broadcast
|
56
|
-
-----------------------------------------------------------------
|
57
|
-
en0 192.168.0.231 255.255.252.0 192.168.0.255
|
58
|
-
lo0 127.0.0.1 255.0.0.0 127.255.255.255
|
59
|
-
|
60
|
-
USER-SPECIFIED ROUTES
|
61
|
-
Type Destination Gateway Interface
|
62
|
-
-----------------------------------------------------------------
|
63
|
-
default 192.168.0.1 en0
|
64
|
-
|
65
|
-
FILE SYSTEMS
|
66
|
-
MountPoint Device Vfs Nodename Options
|
67
|
-
-----------------------------------------------------------------
|
68
|
-
/wpars/sink-thinker-5... /dev/fslv00 jfs2 log=NULL
|
69
|
-
/wpars/sink-thinker-5... /dev/fslv01 jfs2 log=NULL
|
70
|
-
/wpars/sink-thinker-5... /dev/fslv02 jfs2 log=NULL
|
71
|
-
/wpars/sink-thinker-5... /proc namefs rw
|
72
|
-
/wpars/sink-thinker-5... /dev/fslv03 jfs2 log=NULL
|
73
|
-
/wpars/sink-thinker-5... /dev/fslv04 jfs2 log=NULL
|
74
|
-
/wpars/sink-thinker-5... /dev/fslv05 jfs2 log=NULL
|
75
|
-
|
76
|
-
RESOURCE CONTROLS
|
77
|
-
Active: yes
|
78
|
-
Resource Set:
|
79
|
-
CPU Shares: unlimited
|
80
|
-
CPU Limits: 0%-100%,100%
|
81
|
-
Memory Shares: unlimited
|
82
|
-
Memory Limits: 0%-100%,100%
|
83
|
-
Per-Process Virtual Memory Limit: unlimited
|
84
|
-
Total Virtual Memory Limit: unlimited
|
85
|
-
Total Processes: unlimited
|
86
|
-
Total Threads: unlimited
|
87
|
-
Total PTYs: unlimited
|
88
|
-
Total Large Pages: unlimited
|
89
|
-
Max Message Queue IDs: 100%
|
90
|
-
Max Semaphore IDs: 100%
|
91
|
-
Max Shared Memory IDs: 100%
|
92
|
-
Max Pinned Memory: 100%
|
93
|
-
|
94
|
-
OPERATION
|
95
|
-
Operation: none
|
96
|
-
Process ID:
|
97
|
-
Start Time:
|
98
|
-
|
99
|
-
SECURITY SETTINGS
|
100
|
-
Privileges: PV_AU_,PV_AU_ADD,PV_AU_ADMIN,PV_AU_PROC,PV_AU_READ,
|
101
|
-
PV_AU_WRITE,PV_AZ_ADMIN,PV_AZ_CHECK,PV_AZ_READ,PV_AZ_ROOT,
|
102
|
-
PV_DAC_,PV_DAC_GID,PV_DAC_O,PV_DAC_R,PV_DAC_RID,PV_DAC_UID,
|
103
|
-
PV_DAC_W,PV_DAC_X,PV_DEV_CONFIG,PV_DEV_QUERY,PV_FS_CHOWN,
|
104
|
-
PV_FS_CHROOT,PV_FS_CNTL,PV_FS_LINKDIR,PV_FS_MKNOD,
|
105
|
-
PV_FS_MOUNT,PV_FS_PDMODE,PV_FS_QUOTA,PV_KER_ACCT,
|
106
|
-
PV_KER_CONF,PV_KER_DR,PV_KER_EWLM,PV_KER_EXTCONF,
|
107
|
-
PV_KER_IPC,PV_KER_IPC_O,PV_KER_IPC_R,PV_KER_IPC_W,
|
108
|
-
PV_KER_NFS,PV_KER_RAC,PV_KER_RAS_ERR,PV_KER_REBOOT,
|
109
|
-
PV_NET_PORT,PV_PROC_CKPT,PV_PROC_CORE,PV_PROC_CRED,
|
110
|
-
PV_PROC_ENV,PV_PROC_PRIO,PV_PROC_PDMODE,PV_PROC_RAC,
|
111
|
-
PV_PROC_RTCLK,PV_PROC_SIG,PV_PROC_TIMER,PV_PROC_VARS,
|
112
|
-
PV_PROC_PRIV,PV_SU_UID,PV_TCB,PV_TP,PV_TP_SET,PV_MIC,
|
113
|
-
PV_MIC_CL,PV_LAB_,PV_LAB_CL,PV_LAB_CLTL,PV_LAB_LEF,
|
114
|
-
PV_LAB_SLDG,PV_LAB_SLDG_STR,PV_LAB_SL_FILE,PV_LAB_SL_PROC,
|
115
|
-
PV_LAB_SL_SELF,PV_LAB_SLUG,PV_LAB_SLUG_STR,PV_LAB_TL,
|
116
|
-
PV_MAC_,PV_MAC_CL,PV_MAC_R,PV_MAC_R_CL,PV_MAC_R_STR,
|
117
|
-
PV_MAC_R_PROC,PV_MAC_W,PV_MAC_W_CL,PV_MAC_W_DN,PV_MAC_W_UP,
|
118
|
-
PV_MAC_W_PROC,PV_MAC_OVRRD,PV_KER_SECCONFIG,
|
119
|
-
PV_PROBEVUE_TRC_USER,PV_PROBEVUE_TRC_USER_SELF,PV_KER_LVM
|
120
|
-
|
121
|
-
DEVICE EXPORTS
|
122
|
-
Name Type Virtual Device RootVG Status
|
123
|
-
-----------------------------------------------------------------
|
124
|
-
/dev/null pseudo EXPORTED
|
125
|
-
/dev/tty pseudo EXPORTED
|
126
|
-
/dev/console pseudo EXPORTED
|
127
|
-
/dev/zero pseudo EXPORTED
|
128
|
-
/dev/clone pseudo EXPORTED
|
129
|
-
/dev/sad clone EXPORTED
|
130
|
-
/dev/xti/tcp clone EXPORTED
|
131
|
-
/dev/xti/tcp6 clone EXPORTED
|
132
|
-
/dev/xti/udp clone EXPORTED
|
133
|
-
/dev/xti/udp6 clone EXPORTED
|
134
|
-
/dev/xti/unixdg clone EXPORTED
|
135
|
-
/dev/xti/unixst clone EXPORTED
|
136
|
-
/dev/error pseudo EXPORTED
|
137
|
-
/dev/errorctl pseudo EXPORTED
|
138
|
-
/dev/audit pseudo EXPORTED
|
139
|
-
/dev/nvram pseudo EXPORTED
|
140
|
-
|
141
|
-
=================================================================
|
142
|
-
fluttershy-5c969f - Active
|
143
|
-
=================================================================
|
144
|
-
GENERAL
|
145
|
-
Type: S
|
146
|
-
RootVG WPAR: no
|
147
|
-
Owner: root
|
148
|
-
Hostname: fluttershy-pony-5c969f.ponyville.com
|
149
|
-
WPAR-Specific Routing: yes
|
150
|
-
Virtual IP WPAR:
|
151
|
-
Directory: /wpars/fluttershy-5c969f
|
152
|
-
Start/Stop Script:
|
153
|
-
Auto: no
|
154
|
-
Private /usr: yes
|
155
|
-
Checkpointable: no
|
156
|
-
Application:
|
157
|
-
UUID: 6f1fd4be-8be5-4627-8ec0-3a8739cbd9e2
|
158
|
-
|
159
|
-
NETWORK
|
160
|
-
Interface Address(6) Mask/Prefix Broadcast
|
161
|
-
-----------------------------------------------------------------
|
162
|
-
en0 192.168.0.18 255.255.252.0 192.168.0.255
|
163
|
-
lo0 127.0.0.1 255.0.0.0 127.255.255.255
|
164
|
-
|
165
|
-
USER-SPECIFIED ROUTES
|
166
|
-
Type Destination Gateway Interface
|
167
|
-
-----------------------------------------------------------------
|
168
|
-
default 192.168.0.1 en0
|
169
|
-
|
170
|
-
FILE SYSTEMS
|
171
|
-
MountPoint Device Vfs Nodename Options
|
172
|
-
-----------------------------------------------------------------
|
173
|
-
/wpars/toolchain-test... /dev/fslv07 jfs2 log=NULL
|
174
|
-
/wpars/toolchain-test... /dev/fslv08 jfs2 log=NULL
|
175
|
-
/wpars/toolchain-test... /dev/fslv09 jfs2 log=NULL
|
176
|
-
/wpars/toolchain-test... /proc namefs rw
|
177
|
-
/wpars/toolchain-test... /dev/fslv10 jfs2 log=NULL
|
178
|
-
/wpars/toolchain-test... /dev/fslv11 jfs2 log=NULL
|
179
|
-
/wpars/toolchain-test... /dev/fslv12 jfs2 log=NULL
|
180
|
-
|
181
|
-
RESOURCE CONTROLS
|
182
|
-
Active: yes
|
183
|
-
Resource Set:
|
184
|
-
CPU Shares: unlimited
|
185
|
-
CPU Limits: 0%-100%,100%
|
186
|
-
Memory Shares: unlimited
|
187
|
-
Memory Limits: 0%-100%,100%
|
188
|
-
Per-Process Virtual Memory Limit: unlimited
|
189
|
-
Total Virtual Memory Limit: unlimited
|
190
|
-
Total Processes: unlimited
|
191
|
-
Total Threads: unlimited
|
192
|
-
Total PTYs: unlimited
|
193
|
-
Total Large Pages: unlimited
|
194
|
-
Max Message Queue IDs: 100%
|
195
|
-
Max Semaphore IDs: 100%
|
196
|
-
Max Shared Memory IDs: 100%
|
197
|
-
Max Pinned Memory: 100%
|
198
|
-
|
199
|
-
OPERATION
|
200
|
-
Operation: none
|
201
|
-
Process ID:
|
202
|
-
Start Time:
|
203
|
-
|
204
|
-
SECURITY SETTINGS
|
205
|
-
Privileges: PV_AU_,PV_AU_ADD,PV_AU_ADMIN,PV_AU_PROC,PV_AU_READ,
|
206
|
-
PV_AU_WRITE,PV_AZ_ADMIN,PV_AZ_CHECK,PV_AZ_READ,PV_AZ_ROOT,
|
207
|
-
PV_DAC_,PV_DAC_GID,PV_DAC_O,PV_DAC_R,PV_DAC_RID,PV_DAC_UID,
|
208
|
-
PV_DAC_W,PV_DAC_X,PV_DEV_CONFIG,PV_DEV_QUERY,PV_FS_CHOWN,
|
209
|
-
PV_FS_CHROOT,PV_FS_CNTL,PV_FS_LINKDIR,PV_FS_MKNOD,
|
210
|
-
PV_FS_MOUNT,PV_FS_PDMODE,PV_FS_QUOTA,PV_KER_ACCT,
|
211
|
-
PV_KER_CONF,PV_KER_DR,PV_KER_EWLM,PV_KER_EXTCONF,
|
212
|
-
PV_KER_IPC,PV_KER_IPC_O,PV_KER_IPC_R,PV_KER_IPC_W,
|
213
|
-
PV_KER_NFS,PV_KER_RAC,PV_KER_RAS_ERR,PV_KER_REBOOT,
|
214
|
-
PV_NET_PORT,PV_PROC_CKPT,PV_PROC_CORE,PV_PROC_CRED,
|
215
|
-
PV_PROC_ENV,PV_PROC_PRIO,PV_PROC_PDMODE,PV_PROC_RAC,
|
216
|
-
PV_PROC_RTCLK,PV_PROC_SIG,PV_PROC_TIMER,PV_PROC_VARS,
|
217
|
-
PV_PROC_PRIV,PV_SU_UID,PV_TCB,PV_TP,PV_TP_SET,PV_MIC,
|
218
|
-
PV_MIC_CL,PV_LAB_,PV_LAB_CL,PV_LAB_CLTL,PV_LAB_LEF,
|
219
|
-
PV_LAB_SLDG,PV_LAB_SLDG_STR,PV_LAB_SL_FILE,PV_LAB_SL_PROC,
|
220
|
-
PV_LAB_SL_SELF,PV_LAB_SLUG,PV_LAB_SLUG_STR,PV_LAB_TL,
|
221
|
-
PV_MAC_,PV_MAC_CL,PV_MAC_R,PV_MAC_R_CL,PV_MAC_R_STR,
|
222
|
-
PV_MAC_R_PROC,PV_MAC_W,PV_MAC_W_CL,PV_MAC_W_DN,PV_MAC_W_UP,
|
223
|
-
PV_MAC_W_PROC,PV_MAC_OVRRD,PV_KER_SECCONFIG,
|
224
|
-
PV_PROBEVUE_TRC_USER,PV_PROBEVUE_TRC_USER_SELF,PV_KER_LVM
|
225
|
-
|
226
|
-
DEVICE EXPORTS
|
227
|
-
Name Type Virtual Device RootVG Status
|
228
|
-
-----------------------------------------------------------------
|
229
|
-
/dev/null pseudo EXPORTED
|
230
|
-
/dev/tty pseudo EXPORTED
|
231
|
-
/dev/console pseudo EXPORTED
|
232
|
-
/dev/zero pseudo EXPORTED
|
233
|
-
/dev/clone pseudo EXPORTED
|
234
|
-
/dev/sad clone EXPORTED
|
235
|
-
/dev/xti/tcp clone EXPORTED
|
236
|
-
/dev/xti/tcp6 clone EXPORTED
|
237
|
-
/dev/xti/udp clone EXPORTED
|
238
|
-
/dev/xti/udp6 clone EXPORTED
|
239
|
-
/dev/xti/unixdg clone EXPORTED
|
240
|
-
/dev/xti/unixst clone EXPORTED
|
241
|
-
/dev/error pseudo EXPORTED
|
242
|
-
/dev/errorctl pseudo EXPORTED
|
243
|
-
/dev/audit pseudo EXPORTED
|
244
|
-
/dev/nvram pseudo EXPORTED
|
245
|
-
|
246
|
-
|
247
|
-
LSWPAR_L
|
248
|
-
|
249
|
-
end
|
250
|
-
|
251
|
-
it "uname -L detects the LPAR number and name" do
|
252
|
-
plugin.run
|
253
|
-
expect(plugin[:virtualization][:lpar_no]).to eq("29")
|
254
|
-
expect(plugin[:virtualization][:lpar_name]).to eq("l273pp027")
|
255
|
-
end
|
256
|
-
|
257
|
-
context "when WPARs exist on the LPAR" do
|
258
|
-
before do
|
259
|
-
plugin.run
|
260
|
-
end
|
261
|
-
|
262
|
-
let(:wpar1) do
|
263
|
-
plugin[:virtualization][:wpars]["applejack-541ba3"]
|
264
|
-
end
|
265
|
-
|
266
|
-
let(:wpar2) do
|
267
|
-
plugin[:virtualization][:wpars]["fluttershy-5c969f"]
|
268
|
-
end
|
269
|
-
|
270
|
-
it "detects all WPARs present (2)" do
|
271
|
-
expect(plugin[:virtualization][:wpars].length).to eq(2)
|
272
|
-
end
|
273
|
-
|
274
|
-
context "when collecting WPAR info" do
|
275
|
-
it "finds the WPAR's hostname correctly" do
|
276
|
-
expect(wpar1[:hostname]).to eq("applejack-pony-541ba3.ponyville.com")
|
277
|
-
expect(wpar2[:hostname]).to eq("fluttershy-pony-5c969f.ponyville.com")
|
278
|
-
end
|
279
|
-
|
280
|
-
it "finds the WPAR's IP correctly" do
|
281
|
-
expect(wpar1[:address]).to eq("192.168.0.231")
|
282
|
-
expect(wpar2[:address]).to eq("192.168.0.18")
|
283
|
-
end
|
284
|
-
|
285
|
-
it "parses device exports properly" do
|
286
|
-
expect(wpar1["device exports"]["/dev/nvram"]["type"]).to eq("pseudo")
|
287
|
-
expect(wpar1["device exports"]["/dev/nvram"]["status"]).to eq("EXPORTED")
|
288
|
-
end
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
context "when WPARs don't exist on the LPAR" do
|
293
|
-
before do
|
294
|
-
allow(plugin).to receive(:shell_out).with("lswpar -L").and_return(mock_shell_out(0, "", nil))
|
295
|
-
plugin.run
|
296
|
-
end
|
297
|
-
|
298
|
-
it "detects all WPARs present (0)" do
|
299
|
-
expect(plugin[:virtualization][:wpars]).to be_nil
|
300
|
-
end
|
301
|
-
end
|
302
|
-
end
|
303
|
-
|
304
|
-
context "inside a WPAR" do
|
305
|
-
let(:plugin) do
|
306
|
-
p = get_plugin("aix/virtualization")
|
307
|
-
allow(p).to receive(:collect_os).and_return(:aix)
|
308
|
-
allow(p).to receive(:shell_out).with("uname -L").and_return(mock_shell_out(0, "43 l33t", nil))
|
309
|
-
allow(p).to receive(:shell_out).with("uname -W").and_return(mock_shell_out(0, "42", nil))
|
310
|
-
p.run
|
311
|
-
p
|
312
|
-
end
|
313
|
-
|
314
|
-
it "uname -W detects the WPAR number" do
|
315
|
-
expect(plugin[:virtualization][:wpar_no]).to eq("42")
|
316
|
-
end
|
317
|
-
end
|
318
|
-
|
319
|
-
end
|
@@ -1,243 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require "spec_helper"
|
20
|
-
require "open-uri"
|
21
|
-
|
22
|
-
describe Ohai::System, "plugin azure" do
|
23
|
-
let(:plugin) { get_plugin("azure") }
|
24
|
-
let(:hint) do
|
25
|
-
{
|
26
|
-
"public_ip" => "137.135.46.202",
|
27
|
-
"vm_name" => "test-vm",
|
28
|
-
"public_fqdn" => "service.cloudapp.net",
|
29
|
-
"public_ssh_port" => "22",
|
30
|
-
"public_winrm_port" => "5985",
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
let(:response_data) do
|
35
|
-
{ "compute" => { "location" => "westus",
|
36
|
-
"name" => "timtest",
|
37
|
-
"offer" => "UbuntuServer",
|
38
|
-
"osType" => "Linux",
|
39
|
-
"platformFaultDomain" => "0",
|
40
|
-
"platformUpdateDomain" => "0",
|
41
|
-
"publisher" => "Canonical",
|
42
|
-
"sku" => "16.04-LTS",
|
43
|
-
"version" => "16.04.201707270",
|
44
|
-
"vmId" => "f78151b3-da8b-4bd8-a592-d9ce8a57ea65",
|
45
|
-
"vmSize" => "Standard_DS2_v2" },
|
46
|
-
"network" => { "interface" => [ { "ipv4" =>
|
47
|
-
{ "ipAddress" => [{ "privateIpAddress" => "10.0.1.6", "publicIpAddress" => "40.118.212.225" }],
|
48
|
-
"subnet" => [{ "address" => "10.0.1.0", "prefix" => "24" }] },
|
49
|
-
"ipv6" =>
|
50
|
-
{ "ipAddress" => [] },
|
51
|
-
"macAddress" => "000D3A37F080" }] } }
|
52
|
-
end
|
53
|
-
|
54
|
-
before do
|
55
|
-
# skips all the metadata logic unless we want to test it
|
56
|
-
allow(plugin).to receive(:can_socket_connect?)
|
57
|
-
.with(Ohai::Mixin::AzureMetadata::AZURE_METADATA_ADDR, 80)
|
58
|
-
.and_return(false)
|
59
|
-
end
|
60
|
-
|
61
|
-
shared_examples_for "!azure" do
|
62
|
-
it "does not set the azure attribute" do
|
63
|
-
plugin.run
|
64
|
-
expect(plugin[:azure]).to be_nil
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
shared_examples_for "azure" do
|
69
|
-
it "sets the azure attribute" do
|
70
|
-
plugin.run
|
71
|
-
expect(plugin[:azure]).to be_truthy
|
72
|
-
expect(plugin[:azure]).to have_key(:metadata)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "with azure hint file" do
|
77
|
-
before do
|
78
|
-
allow(plugin).to receive(:hint?).with("azure").and_return(hint)
|
79
|
-
end
|
80
|
-
|
81
|
-
it "sets the azure cloud attributes" do
|
82
|
-
plugin.run
|
83
|
-
expect(plugin[:azure]["public_ip"]).to eq("137.135.46.202")
|
84
|
-
expect(plugin[:azure]["vm_name"]).to eq("test-vm")
|
85
|
-
expect(plugin[:azure]["public_fqdn"]).to eq("service.cloudapp.net")
|
86
|
-
expect(plugin[:azure]["public_ssh_port"]).to eq("22")
|
87
|
-
expect(plugin[:azure]["public_winrm_port"]).to eq("5985")
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "without azure hint file or agent or dhcp options" do
|
93
|
-
before do
|
94
|
-
allow(plugin).to receive(:hint?).with("azure").and_return(false)
|
95
|
-
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(false)
|
96
|
-
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
97
|
-
allow(File).to receive(:exist?).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(true)
|
98
|
-
@double_file = double("/var/lib/dhcp/dhclient.eth0.leases")
|
99
|
-
allow(@double_file).to receive(:each)
|
100
|
-
.and_yield("lease {")
|
101
|
-
.and_yield(' interface "eth0";')
|
102
|
-
.and_yield(" fixed-address 192.168.1.194;")
|
103
|
-
.and_yield(" option subnet-mask 255.255.255.0;")
|
104
|
-
.and_yield(" option routers 192.168.1.1;")
|
105
|
-
.and_yield(" option dhcp-lease-time 86400;")
|
106
|
-
.and_yield(" option dhcp-message-type 5;")
|
107
|
-
.and_yield(" option domain-name-servers 8.8.8.8;")
|
108
|
-
.and_yield(" option dhcp-server-identifier 192.168.1.2;")
|
109
|
-
.and_yield(" option interface-mtu 1454;")
|
110
|
-
.and_yield(" option dhcp-renewal-time 42071;")
|
111
|
-
.and_yield(" option broadcast-address 192.168.1.255;")
|
112
|
-
.and_yield(" option dhcp-rebinding-time 74471;")
|
113
|
-
.and_yield(' option host-name "host-192-168-1-194";')
|
114
|
-
.and_yield(' option domain-name "openstacklocal";')
|
115
|
-
.and_yield(" renew 2 2016/03/01 01:49:41;")
|
116
|
-
.and_yield(" rebind 2 2016/03/01 13:22:07;")
|
117
|
-
.and_yield(" expire 2 2016/03/01 16:40:56;")
|
118
|
-
.and_yield("}")
|
119
|
-
allow(File).to receive(:open).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(@double_file)
|
120
|
-
end
|
121
|
-
|
122
|
-
it_behaves_like "!azure"
|
123
|
-
end
|
124
|
-
|
125
|
-
describe "with rackspace hint file, no agent, and no dhcp lease" do
|
126
|
-
before do
|
127
|
-
allow(plugin).to receive(:hint?).with("rackspace").and_return(true)
|
128
|
-
allow(plugin).to receive(:hint?).with("azure").and_return(false)
|
129
|
-
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(false)
|
130
|
-
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
131
|
-
allow(File).to receive(:exist?).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(false)
|
132
|
-
end
|
133
|
-
|
134
|
-
it_behaves_like "!azure"
|
135
|
-
end
|
136
|
-
|
137
|
-
describe "without azure hint file but with agent on linux" do
|
138
|
-
before do
|
139
|
-
allow(plugin).to receive(:hint?).with("azure").and_return(false)
|
140
|
-
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(true)
|
141
|
-
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
142
|
-
end
|
143
|
-
|
144
|
-
it_behaves_like "azure"
|
145
|
-
end
|
146
|
-
|
147
|
-
describe "without azure hint file but with agent on windows" do
|
148
|
-
before do
|
149
|
-
allow(plugin).to receive(:hint?).with("azure").and_return(false)
|
150
|
-
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(false)
|
151
|
-
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(true)
|
152
|
-
end
|
153
|
-
|
154
|
-
it_behaves_like "azure"
|
155
|
-
end
|
156
|
-
|
157
|
-
describe "without azure hint or agent but with dhcp option" do
|
158
|
-
before do
|
159
|
-
allow(plugin).to receive(:hint?).with("azure").and_return(false)
|
160
|
-
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(false)
|
161
|
-
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
162
|
-
allow(File).to receive(:exist?).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(true)
|
163
|
-
@double_file = double("/var/lib/dhcp/dhclient.eth0.leases")
|
164
|
-
allow(@double_file).to receive(:each)
|
165
|
-
.and_yield("lease {")
|
166
|
-
.and_yield(' interface "eth0";')
|
167
|
-
.and_yield(" fixed-address 10.1.0.5;")
|
168
|
-
.and_yield(' server-name "RD24BE05C6F140";')
|
169
|
-
.and_yield(" option subnet-mask 255.255.255.0;")
|
170
|
-
.and_yield(" option dhcp-lease-time 4294967295;")
|
171
|
-
.and_yield(" option routers 10.1.0.1;")
|
172
|
-
.and_yield(" option dhcp-message-type 5;")
|
173
|
-
.and_yield(" option dhcp-server-identifier 168.63.129.16;")
|
174
|
-
.and_yield(" option domain-name-servers 168.63.129.16;")
|
175
|
-
.and_yield(" option dhcp-renewal-time 4294967295;")
|
176
|
-
.and_yield(" option rfc3442-classless-static-routes 0,10,1,0,1,32,168,63,129,16,10,1,0,1;")
|
177
|
-
.and_yield(" option unknown-245 a8:3f:81:10;")
|
178
|
-
.and_yield(" option dhcp-rebinding-time 4294967295;")
|
179
|
-
.and_yield(' option domain-name "v4wvfurds4relghweduc4zqjmd.dx.internal.cloudapp.net";')
|
180
|
-
.and_yield(" renew 5 2152/03/10 09:03:39;")
|
181
|
-
.and_yield(" rebind 5 2152/03/10 09:03:39;")
|
182
|
-
.and_yield(" expire 5 2152/03/10 09:03:39;")
|
183
|
-
.and_yield("}")
|
184
|
-
allow(File).to receive(:open).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(@double_file)
|
185
|
-
end
|
186
|
-
|
187
|
-
it_behaves_like "azure"
|
188
|
-
end
|
189
|
-
|
190
|
-
describe "with non-responsive metadata endpoint" do
|
191
|
-
before do
|
192
|
-
allow(plugin).to receive(:hint?).with("azure").and_return({})
|
193
|
-
end
|
194
|
-
|
195
|
-
it "does not return metadata information" do
|
196
|
-
allow(plugin).to receive(:can_socket_connect?)
|
197
|
-
.with(Ohai::Mixin::AzureMetadata::AZURE_METADATA_ADDR, 80)
|
198
|
-
.and_return(true)
|
199
|
-
allow(plugin).to receive(:fetch_metadata).and_return(nil)
|
200
|
-
|
201
|
-
plugin.run
|
202
|
-
expect(plugin[:azure]).to have_key(:metadata)
|
203
|
-
expect(plugin[:azure][:metadata]).to be_nil
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
describe "with responsive metadata endpoint" do
|
208
|
-
before do
|
209
|
-
allow(plugin).to receive(:hint?).with("azure").and_return({})
|
210
|
-
allow(plugin).to receive(:can_socket_connect?)
|
211
|
-
.with(Ohai::Mixin::AzureMetadata::AZURE_METADATA_ADDR, 80)
|
212
|
-
.and_return(true)
|
213
|
-
allow(plugin).to receive(:fetch_metadata).and_return(response_data)
|
214
|
-
plugin.run
|
215
|
-
end
|
216
|
-
|
217
|
-
it "returns metadata compute information" do
|
218
|
-
expect(plugin[:azure][:metadata][:compute][:location]).to eq("westus")
|
219
|
-
expect(plugin[:azure][:metadata][:compute][:name]).to eq("timtest")
|
220
|
-
expect(plugin[:azure][:metadata][:compute][:offer]).to eq("UbuntuServer")
|
221
|
-
expect(plugin[:azure][:metadata][:compute][:osType]).to eq("Linux")
|
222
|
-
expect(plugin[:azure][:metadata][:compute][:platformFaultDomain]).to eq("0")
|
223
|
-
expect(plugin[:azure][:metadata][:compute][:platformUpdateDomain]).to eq("0")
|
224
|
-
expect(plugin[:azure][:metadata][:compute][:publisher]).to eq("Canonical")
|
225
|
-
expect(plugin[:azure][:metadata][:compute][:sku]).to eq("16.04-LTS")
|
226
|
-
expect(plugin[:azure][:metadata][:compute][:version]).to eq("16.04.201707270")
|
227
|
-
expect(plugin[:azure][:metadata][:compute][:vmId]).to eq("f78151b3-da8b-4bd8-a592-d9ce8a57ea65")
|
228
|
-
expect(plugin[:azure][:metadata][:compute][:vmSize]).to eq("Standard_DS2_v2")
|
229
|
-
end
|
230
|
-
|
231
|
-
it "returns metadata network information" do
|
232
|
-
expect(plugin[:azure][:metadata][:network][:interfaces]["000D3A37F080"][:mac]).to eq("000D3A37F080")
|
233
|
-
expect(plugin[:azure][:metadata][:network][:interfaces]["000D3A37F080"][:public_ipv6]).to eq([])
|
234
|
-
expect(plugin[:azure][:metadata][:network][:interfaces]["000D3A37F080"][:public_ipv4]).to eq(["40.118.212.225"])
|
235
|
-
expect(plugin[:azure][:metadata][:network][:interfaces]["000D3A37F080"][:local_ipv6]).to eq([])
|
236
|
-
expect(plugin[:azure][:metadata][:network][:interfaces]["000D3A37F080"][:local_ipv4]).to eq(["10.0.1.6"])
|
237
|
-
expect(plugin[:azure][:metadata][:network][:public_ipv6]).to eq([])
|
238
|
-
expect(plugin[:azure][:metadata][:network][:public_ipv4]).to eq(["40.118.212.225"])
|
239
|
-
expect(plugin[:azure][:metadata][:network][:local_ipv6]).to eq([])
|
240
|
-
expect(plugin[:azure][:metadata][:network][:local_ipv4]).to eq(["10.0.1.6"])
|
241
|
-
end
|
242
|
-
end
|
243
|
-
end
|