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
@@ -16,7 +16,7 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
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, "AIX network plugin" do
|
22
22
|
|
@@ -94,15 +94,15 @@ ARP_AN
|
|
94
94
|
end
|
95
95
|
|
96
96
|
it "detects network information" do
|
97
|
-
expect(@plugin[
|
97
|
+
expect(@plugin["network"]).not_to be_nil
|
98
98
|
end
|
99
99
|
|
100
100
|
it "detects the interfaces" do
|
101
|
-
expect(@plugin[
|
101
|
+
expect(@plugin["network"]["interfaces"].keys.sort).to eq(%w{en0 en1 lo0})
|
102
102
|
end
|
103
103
|
|
104
104
|
it "detects the ip addresses of the interfaces" do
|
105
|
-
expect(@plugin[
|
105
|
+
expect(@plugin["network"]["interfaces"]["en0"]["addresses"].keys).to include("172.29.174.58")
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
@@ -124,11 +124,11 @@ ARP_AN
|
|
124
124
|
end
|
125
125
|
|
126
126
|
it "returns the default gateway of the system's network" do
|
127
|
-
expect(@plugin[:network][:default_gateway]).to eq(
|
127
|
+
expect(@plugin[:network][:default_gateway]).to eq("172.31.8.1")
|
128
128
|
end
|
129
129
|
|
130
130
|
it "returns the default interface of the system's network" do
|
131
|
-
expect(@plugin[:network][:default_interface]).to eq(
|
131
|
+
expect(@plugin[:network][:default_interface]).to eq("en0")
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
@@ -155,42 +155,42 @@ ARP_AN
|
|
155
155
|
describe "lsdev -Cc if" do
|
156
156
|
it "detects the state of the interfaces in the system" do
|
157
157
|
@plugin.run
|
158
|
-
expect(@plugin[
|
158
|
+
expect(@plugin["network"]["interfaces"]["en0"][:state]).to eq("up")
|
159
159
|
end
|
160
160
|
|
161
161
|
describe "ifconfig interface" do
|
162
162
|
it "detects the CHAIN network flag" do
|
163
163
|
@plugin.run
|
164
|
-
expect(@plugin[
|
164
|
+
expect(@plugin["network"]["interfaces"]["en0"][:flags]).to include("CHAIN")
|
165
165
|
end
|
166
166
|
|
167
167
|
it "detects the metric network flag" do
|
168
168
|
@plugin.run
|
169
|
-
expect(@plugin[
|
169
|
+
expect(@plugin["network"]["interfaces"]["en0"][:metric]).to eq("1")
|
170
170
|
end
|
171
171
|
|
172
172
|
context "inet entries" do
|
173
173
|
before do
|
174
174
|
@plugin.run
|
175
|
-
@inet_entry = @plugin[
|
175
|
+
@inet_entry = @plugin["network"]["interfaces"]["en0"][:addresses]["172.29.174.58"]
|
176
176
|
end
|
177
177
|
|
178
178
|
it "detects the family" do
|
179
|
-
expect(@inet_entry[:family]).to eq(
|
179
|
+
expect(@inet_entry[:family]).to eq("inet")
|
180
180
|
end
|
181
181
|
|
182
182
|
it "detects the netmask" do
|
183
|
-
expect(@inet_entry[:netmask]).to eq(
|
183
|
+
expect(@inet_entry[:netmask]).to eq("255.255.192.0")
|
184
184
|
end
|
185
185
|
|
186
186
|
it "detects the broadcast" do
|
187
|
-
expect(@inet_entry[:broadcast]).to eq(
|
187
|
+
expect(@inet_entry[:broadcast]).to eq("172.29.191.255")
|
188
188
|
end
|
189
189
|
|
190
190
|
it "detects all key-values" do
|
191
|
-
expect(@plugin[
|
192
|
-
expect(@plugin[
|
193
|
-
expect(@plugin[
|
191
|
+
expect(@plugin["network"]["interfaces"]["en0"][:tcp_sendspace]).to eq("262144")
|
192
|
+
expect(@plugin["network"]["interfaces"]["en0"][:tcp_recvspace]).to eq("262144")
|
193
|
+
expect(@plugin["network"]["interfaces"]["en0"][:rfc1323]).to eq("1")
|
194
194
|
end
|
195
195
|
|
196
196
|
# For an output with no netmask like inet 172.29.174.59 broadcast 172.29.191.255
|
@@ -200,13 +200,13 @@ ARP_AN
|
|
200
200
|
end
|
201
201
|
|
202
202
|
it "detects the default prefixlen" do
|
203
|
-
@inet_entry = @plugin[
|
204
|
-
expect(@inet_entry[:prefixlen]).to eq(
|
203
|
+
@inet_entry = @plugin["network"]["interfaces"]["en0"][:addresses]["172.29.174.59"]
|
204
|
+
expect(@inet_entry[:prefixlen]).to eq("32")
|
205
205
|
end
|
206
206
|
|
207
207
|
it "detects the default netmask" do
|
208
|
-
@inet_entry = @plugin[
|
209
|
-
expect(@inet_entry[:netmask]).to eq(
|
208
|
+
@inet_entry = @plugin["network"]["interfaces"]["en0"][:addresses]["172.29.174.59"]
|
209
|
+
expect(@inet_entry[:netmask]).to eq("255.255.255.255")
|
210
210
|
end
|
211
211
|
end
|
212
212
|
end
|
@@ -214,15 +214,15 @@ ARP_AN
|
|
214
214
|
context "inet6 entries" do
|
215
215
|
before do
|
216
216
|
@plugin.run
|
217
|
-
@inet_entry = @plugin[
|
217
|
+
@inet_entry = @plugin["network"]["interfaces"]["en0"][:addresses]["::1"]
|
218
218
|
end
|
219
219
|
|
220
220
|
it "detects the prefixlen" do
|
221
|
-
expect(@inet_entry[:prefixlen]).to eq(
|
221
|
+
expect(@inet_entry[:prefixlen]).to eq("0")
|
222
222
|
end
|
223
223
|
|
224
224
|
it "detects the family" do
|
225
|
-
expect(@inet_entry[:family]).to eq(
|
225
|
+
expect(@inet_entry[:family]).to eq("inet6")
|
226
226
|
end
|
227
227
|
end
|
228
228
|
end
|
@@ -230,10 +230,10 @@ ARP_AN
|
|
230
230
|
context "entstat -d interface" do
|
231
231
|
before do
|
232
232
|
@plugin.run
|
233
|
-
@inet_interface_addresses = @plugin[
|
233
|
+
@inet_interface_addresses = @plugin["network"]["interfaces"]["en0"][:addresses]["BE:42:80:00:B0:05"]
|
234
234
|
end
|
235
235
|
it "detects the family" do
|
236
|
-
expect(@inet_interface_addresses[:family]).to eq(
|
236
|
+
expect(@inet_interface_addresses[:family]).to eq("lladdr")
|
237
237
|
end
|
238
238
|
end
|
239
239
|
end
|
@@ -245,39 +245,39 @@ ARP_AN
|
|
245
245
|
|
246
246
|
context "inet" do
|
247
247
|
it "detects the route destinations" do
|
248
|
-
expect(@plugin[
|
249
|
-
expect(@plugin[
|
248
|
+
expect(@plugin["network"]["interfaces"]["en0"][:routes][0][:destination]).to eq("default")
|
249
|
+
expect(@plugin["network"]["interfaces"]["en0"][:routes][1][:destination]).to eq("172.29.128.0")
|
250
250
|
end
|
251
251
|
|
252
252
|
it "detects the route family" do
|
253
|
-
expect(@plugin[
|
253
|
+
expect(@plugin["network"]["interfaces"]["en0"][:routes][0][:family]).to eq("inet")
|
254
254
|
end
|
255
255
|
|
256
256
|
it "detects the route gateway" do
|
257
|
-
expect(@plugin[
|
257
|
+
expect(@plugin["network"]["interfaces"]["en0"][:routes][0][:via]).to eq("172.29.128.13")
|
258
258
|
end
|
259
259
|
|
260
260
|
it "detects the route flags" do
|
261
|
-
expect(@plugin[
|
261
|
+
expect(@plugin["network"]["interfaces"]["en0"][:routes][0][:flags]).to eq("UG")
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
265
265
|
context "inet6" do
|
266
266
|
|
267
267
|
it "detects the route destinations" do
|
268
|
-
expect(@plugin[
|
268
|
+
expect(@plugin["network"]["interfaces"]["en0"][:routes][4][:destination]).to eq("::1%1")
|
269
269
|
end
|
270
270
|
|
271
271
|
it "detects the route family" do
|
272
|
-
expect(@plugin[
|
272
|
+
expect(@plugin["network"]["interfaces"]["en0"][:routes][4][:family]).to eq("inet6")
|
273
273
|
end
|
274
274
|
|
275
275
|
it "detects the route gateway" do
|
276
|
-
expect(@plugin[
|
276
|
+
expect(@plugin["network"]["interfaces"]["en0"][:routes][4][:via]).to eq("::1%1")
|
277
277
|
end
|
278
278
|
|
279
279
|
it "detects the route flags" do
|
280
|
-
expect(@plugin[
|
280
|
+
expect(@plugin["network"]["interfaces"]["en0"][:routes][4][:flags]).to eq("UH")
|
281
281
|
end
|
282
282
|
end
|
283
283
|
end
|
@@ -287,15 +287,15 @@ ARP_AN
|
|
287
287
|
@plugin.run
|
288
288
|
end
|
289
289
|
it "supresses the hostname entries" do
|
290
|
-
expect(@plugin[
|
290
|
+
expect(@plugin["network"]["arp"][0][:remote_host]).to eq("?")
|
291
291
|
end
|
292
292
|
|
293
293
|
it "detects the remote ip entry" do
|
294
|
-
expect(@plugin[
|
294
|
+
expect(@plugin["network"]["arp"][0][:remote_ip]).to eq("172.29.131.16")
|
295
295
|
end
|
296
296
|
|
297
297
|
it "detects the remote mac entry" do
|
298
|
-
expect(@plugin[
|
298
|
+
expect(@plugin["network"]["arp"][0][:remote_mac]).to eq("6e:87:70:0:40:3")
|
299
299
|
end
|
300
300
|
end
|
301
301
|
|
@@ -304,7 +304,7 @@ ARP_AN
|
|
304
304
|
@plugin.run
|
305
305
|
end
|
306
306
|
it "converts a netmask from hexadecimal form to decimal form" do
|
307
|
-
expect(@plugin.hex_to_dec_netmask(
|
307
|
+
expect(@plugin.hex_to_dec_netmask("0xffff0000")).to eq("255.255.0.0")
|
308
308
|
end
|
309
309
|
end
|
310
310
|
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
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, "AIX os plugin" do
|
21
21
|
before(:each) do
|
@@ -32,4 +32,3 @@ describe Ohai::System, "AIX os plugin" do
|
|
32
32
|
expect(@plugin[:os_version]).to eql("6")
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
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, "Aix plugin platform" do
|
22
22
|
before(:each) do
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
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, "Aix plugin uptime" do
|
22
22
|
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
require
|
19
|
+
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "AIX virtualization plugin" do
|
22
22
|
|
@@ -254,24 +254,24 @@ LSWPAR_L
|
|
254
254
|
expect(plugin[:virtualization][:lpar_name]).to eq("l273pp027")
|
255
255
|
end
|
256
256
|
|
257
|
-
context
|
257
|
+
context "when WPARs exist on the LPAR" do
|
258
258
|
before do
|
259
259
|
plugin.run
|
260
260
|
end
|
261
261
|
|
262
262
|
let(:wpar1) do
|
263
|
-
plugin[:virtualization][:wpars][
|
263
|
+
plugin[:virtualization][:wpars]["applejack-541ba3"]
|
264
264
|
end
|
265
265
|
|
266
266
|
let(:wpar2) do
|
267
|
-
plugin[:virtualization][:wpars][
|
267
|
+
plugin[:virtualization][:wpars]["fluttershy-5c969f"]
|
268
268
|
end
|
269
269
|
|
270
|
-
it
|
270
|
+
it "detects all WPARs present (2)" do
|
271
271
|
expect(plugin[:virtualization][:wpars].length).to eq(2)
|
272
272
|
end
|
273
273
|
|
274
|
-
context
|
274
|
+
context "when collecting WPAR info" do
|
275
275
|
it 'finds the WPAR\'s hostname correctly' do
|
276
276
|
expect(wpar1[:hostname]).to eq("applejack-pony-541ba3.ponyville.com")
|
277
277
|
expect(wpar2[:hostname]).to eq("fluttershy-pony-5c969f.ponyville.com")
|
@@ -282,20 +282,20 @@ LSWPAR_L
|
|
282
282
|
expect(wpar2[:address]).to eq("192.168.0.18")
|
283
283
|
end
|
284
284
|
|
285
|
-
it
|
286
|
-
expect(wpar1[
|
287
|
-
expect(wpar1[
|
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
288
|
end
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
292
|
context 'when WPARs don\'t exist on the LPAR' do
|
293
293
|
before do
|
294
|
-
allow(plugin).to receive(:shell_out).with("lswpar -L").and_return(mock_shell_out(0,
|
294
|
+
allow(plugin).to receive(:shell_out).with("lswpar -L").and_return(mock_shell_out(0, "", nil))
|
295
295
|
plugin.run
|
296
296
|
end
|
297
297
|
|
298
|
-
it
|
298
|
+
it "detects all WPARs present (0)" do
|
299
299
|
expect(plugin[:virtualization][:wpars]).to be_nil
|
300
300
|
end
|
301
301
|
end
|
@@ -16,57 +16,155 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
20
|
-
require
|
21
|
-
require 'open-uri'
|
19
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
|
20
|
+
require "open-uri"
|
22
21
|
|
23
22
|
describe Ohai::System, "plugin azure" do
|
24
23
|
before(:each) do
|
25
24
|
@plugin = get_plugin("azure")
|
26
25
|
end
|
27
26
|
|
28
|
-
describe "with azure
|
27
|
+
describe "with azure hint file" do
|
29
28
|
before(:each) do
|
30
|
-
allow(File).to receive(:exist?).with(
|
31
|
-
allow(File).to receive(:read).with(
|
29
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/azure.json").and_return(true)
|
30
|
+
allow(File).to receive(:read).with("/etc/chef/ohai/hints/azure.json").and_return('{"public_ip":"137.135.46.202","vm_name":"test-vm","public_fqdn":"service.cloudapp.net","public_ssh_port":"22", "public_winrm_port":"5985"}')
|
32
31
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(true)
|
33
32
|
allow(File).to receive(:read).with('C:\chef\ohai\hints/azure.json').and_return('{"public_ip":"137.135.46.202","vm_name":"test-vm","public_fqdn":"service.cloudapp.net","public_ssh_port":"22", "public_winrm_port":"5985"}')
|
34
33
|
@plugin.run
|
35
34
|
end
|
36
35
|
|
37
|
-
it
|
36
|
+
it "should set the azure cloud attributes" do
|
38
37
|
expect(@plugin[:azure]).not_to be_nil
|
39
|
-
expect(@plugin[:azure][
|
40
|
-
expect(@plugin[:azure][
|
41
|
-
expect(@plugin[:azure][
|
42
|
-
expect(@plugin[:azure][
|
43
|
-
expect(@plugin[:azure][
|
38
|
+
expect(@plugin[:azure]["public_ip"]).to eq("137.135.46.202")
|
39
|
+
expect(@plugin[:azure]["vm_name"]).to eq("test-vm")
|
40
|
+
expect(@plugin[:azure]["public_fqdn"]).to eq("service.cloudapp.net")
|
41
|
+
expect(@plugin[:azure]["public_ssh_port"]).to eq("22")
|
42
|
+
expect(@plugin[:azure]["public_winrm_port"]).to eq("5985")
|
44
43
|
end
|
45
44
|
|
46
45
|
end
|
47
46
|
|
48
|
-
describe "without azure
|
47
|
+
describe "without azure hint file or agent or dhcp options" do
|
49
48
|
before(:each) do
|
50
|
-
allow(File).to receive(:exist?).with(
|
49
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/azure.json").and_return(false)
|
51
50
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(false)
|
51
|
+
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(false)
|
52
|
+
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
53
|
+
allow(File).to receive(:exist?).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(true)
|
54
|
+
@double_file = double("/var/lib/dhcp/dhclient.eth0.leases")
|
55
|
+
allow(@double_file).to receive(:each).
|
56
|
+
and_yield("lease {").
|
57
|
+
and_yield(' interface "eth0";').
|
58
|
+
and_yield(" fixed-address 192.168.1.194;").
|
59
|
+
and_yield(" option subnet-mask 255.255.255.0;").
|
60
|
+
and_yield(" option routers 192.168.1.1;").
|
61
|
+
and_yield(" option dhcp-lease-time 86400;").
|
62
|
+
and_yield(" option dhcp-message-type 5;").
|
63
|
+
and_yield(" option domain-name-servers 8.8.8.8;").
|
64
|
+
and_yield(" option dhcp-server-identifier 192.168.1.2;").
|
65
|
+
and_yield(" option interface-mtu 1454;").
|
66
|
+
and_yield(" option dhcp-renewal-time 42071;").
|
67
|
+
and_yield(" option broadcast-address 192.168.1.255;").
|
68
|
+
and_yield(" option dhcp-rebinding-time 74471;").
|
69
|
+
and_yield(' option host-name "host-192-168-1-194";').
|
70
|
+
and_yield(' option domain-name "openstacklocal";').
|
71
|
+
and_yield(" renew 2 2016/03/01 01:49:41;").
|
72
|
+
and_yield(" rebind 2 2016/03/01 13:22:07;").
|
73
|
+
and_yield(" expire 2 2016/03/01 16:40:56;").
|
74
|
+
and_yield("}")
|
75
|
+
allow(File).to receive(:open).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(@double_file)
|
76
|
+
@plugin.run
|
52
77
|
end
|
53
78
|
|
54
|
-
it
|
79
|
+
it "should not behave like azure" do
|
55
80
|
expect(@plugin[:azure]).to be_nil
|
56
81
|
end
|
57
82
|
end
|
58
83
|
|
59
|
-
describe "with rackspace
|
84
|
+
describe "with rackspace hint file no agent and no dhcp lease" do
|
60
85
|
before(:each) do
|
61
|
-
allow(File).to receive(:exist?).with(
|
62
|
-
allow(File).to receive(:read).with(
|
86
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/rackspace.json").and_return(true)
|
87
|
+
allow(File).to receive(:read).with("/etc/chef/ohai/hints/rackspace.json").and_return("")
|
63
88
|
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(true)
|
64
|
-
allow(File).to receive(:read).with('C:\chef\ohai\hints/rackspace.json').and_return(
|
89
|
+
allow(File).to receive(:read).with('C:\chef\ohai\hints/rackspace.json').and_return("")
|
90
|
+
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(false)
|
91
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/azure.json").and_return(false)
|
92
|
+
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(false)
|
93
|
+
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
94
|
+
allow(File).to receive(:exist?).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(false)
|
95
|
+
@plugin.run
|
65
96
|
end
|
66
97
|
|
67
|
-
it
|
98
|
+
it "should not behave like azure" do
|
68
99
|
expect(@plugin[:azure]).to be_nil
|
69
100
|
end
|
70
101
|
end
|
71
102
|
|
103
|
+
describe "without azure hint file but with agent on linux" do
|
104
|
+
before(:each) do
|
105
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/azure.json").and_return(false)
|
106
|
+
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(false)
|
107
|
+
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(true)
|
108
|
+
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
109
|
+
@plugin.run
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should create empty azure mash" do
|
113
|
+
expect(@plugin[:azure]).to be_empty
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "without azure hint file but with agent on windows" do
|
118
|
+
before(:each) do
|
119
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/azure.json").and_return(false)
|
120
|
+
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(false)
|
121
|
+
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(false)
|
122
|
+
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(true)
|
123
|
+
@plugin.run
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should create empty azure mash" do
|
127
|
+
puts "The dir exists?:" + "#{Dir.exist?('C:\WindowsAzure')}"
|
128
|
+
expect(@plugin[:azure]).to be_empty
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe "without azure hint or agent but with dhcp option" do
|
133
|
+
before(:each) do
|
134
|
+
allow(File).to receive(:exist?).with("/etc/chef/ohai/hints/azure.json").and_return(false)
|
135
|
+
allow(File).to receive(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(false)
|
136
|
+
allow(File).to receive(:exist?).with("/usr/sbin/waagent").and_return(false)
|
137
|
+
allow(Dir).to receive(:exist?).with('C:\WindowsAzure').and_return(false)
|
138
|
+
allow(File).to receive(:exist?).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(true)
|
139
|
+
@double_file = double("/var/lib/dhcp/dhclient.eth0.leases")
|
140
|
+
allow(@double_file).to receive(:each).
|
141
|
+
and_yield("lease {").
|
142
|
+
and_yield(' interface "eth0";').
|
143
|
+
and_yield(" fixed-address 10.1.0.5;").
|
144
|
+
and_yield(' server-name "RD24BE05C6F140";').
|
145
|
+
and_yield(" option subnet-mask 255.255.255.0;").
|
146
|
+
and_yield(" option dhcp-lease-time 4294967295;").
|
147
|
+
and_yield(" option routers 10.1.0.1;").
|
148
|
+
and_yield(" option dhcp-message-type 5;").
|
149
|
+
and_yield(" option dhcp-server-identifier 168.63.129.16;").
|
150
|
+
and_yield(" option domain-name-servers 168.63.129.16;").
|
151
|
+
and_yield(" option dhcp-renewal-time 4294967295;").
|
152
|
+
and_yield(" option rfc3442-classless-static-routes 0,10,1,0,1,32,168,63,129,16,10,1,0,1;").
|
153
|
+
and_yield(" option unknown-245 a8:3f:81:10;").
|
154
|
+
and_yield(" option dhcp-rebinding-time 4294967295;").
|
155
|
+
and_yield(' option domain-name "v4wvfurds4relghweduc4zqjmd.dx.internal.cloudapp.net";').
|
156
|
+
and_yield(" renew 5 2152/03/10 09:03:39;").
|
157
|
+
and_yield(" rebind 5 2152/03/10 09:03:39;").
|
158
|
+
and_yield(" expire 5 2152/03/10 09:03:39;").
|
159
|
+
and_yield("}")
|
160
|
+
allow(File).to receive(:open).with("/var/lib/dhcp/dhclient.eth0.leases").and_return(@double_file)
|
161
|
+
@plugin.run
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should create empty azure mash" do
|
165
|
+
puts "The dir exists?:" + "#{Dir.exist?('C:\WindowsAzure')}"
|
166
|
+
expect(@plugin[:azure]).to be_empty
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
72
170
|
end
|