ohai 8.26.1 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +3 -4
- data/Rakefile +14 -0
- data/lib/ohai/application.rb +1 -0
- data/lib/ohai/config.rb +2 -88
- data/lib/ohai/dsl/plugin.rb +0 -4
- data/lib/ohai/exception.rb +0 -1
- data/lib/ohai/loader.rb +11 -2
- data/lib/ohai/log.rb +3 -1
- data/lib/ohai/mixin/command.rb +1 -318
- data/lib/ohai/mixin/do_metadata.rb +47 -0
- data/lib/ohai/mixin/ec2_metadata.rb +2 -29
- data/lib/ohai/mixin/gce_metadata.rb +0 -37
- data/lib/ohai/mixin/http_helper.rb +56 -0
- data/lib/ohai/mixin/network_constants.rb +0 -5
- data/lib/ohai/plugins/cloud.rb +144 -157
- data/lib/ohai/plugins/darwin/filesystem.rb +68 -22
- data/lib/ohai/plugins/digital_ocean.rb +24 -42
- data/lib/ohai/plugins/dmi.rb +81 -77
- data/lib/ohai/plugins/ec2.rb +33 -60
- data/lib/ohai/plugins/gce.rb +3 -1
- data/lib/ohai/plugins/hostname.rb +1 -16
- data/lib/ohai/plugins/linux/filesystem.rb +130 -81
- data/lib/ohai/plugins/linux/mdadm.rb +3 -45
- data/lib/ohai/plugins/linux/network.rb +1 -26
- data/lib/ohai/plugins/linux/platform.rb +4 -2
- data/lib/ohai/plugins/linux/virtualization.rb +1 -5
- data/lib/ohai/plugins/scala.rb +1 -13
- data/lib/ohai/plugins/solaris2/network.rb +1 -2
- data/lib/ohai/plugins/uptime.rb +0 -9
- data/lib/ohai/plugins/windows/cpu.rb +2 -1
- data/lib/ohai/plugins/windows/network.rb +1 -1
- data/lib/ohai/runner.rb +0 -5
- data/lib/ohai/system.rb +38 -8
- data/lib/ohai/version.rb +2 -2
- data/ohai.gemspec +1 -1
- data/spec/functional/application_spec.rb +0 -40
- data/spec/functional/plugins/powershell_spec.rb +1 -1
- data/spec/functional/plugins/root_group_spec.rb +1 -1
- data/spec/functional/plugins/windows/uptime_spec.rb +1 -1
- data/spec/ohai_spec.rb +1 -1
- data/spec/support/integration_helper.rb +17 -0
- data/spec/support/platform_helpers.rb +17 -0
- data/spec/unit/application_spec.rb +0 -1
- data/spec/unit/config_spec.rb +0 -111
- data/spec/unit/dsl/plugin_spec.rb +1 -1
- data/spec/unit/hints_spec.rb +1 -1
- data/spec/unit/loader_spec.rb +26 -1
- data/spec/unit/mixin/command_spec.rb +1 -69
- data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
- data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +0 -1
- data/spec/unit/plugins/abort_spec.rb +1 -1
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +2 -1
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -1
- data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
- data/spec/unit/plugins/aix/memory_spec.rb +1 -1
- data/spec/unit/plugins/aix/network_spec.rb +1 -1
- data/spec/unit/plugins/aix/os_spec.rb +1 -1
- 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 +1 -1
- data/spec/unit/plugins/azure_spec.rb +1 -1
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/c_spec.rb +1 -1
- data/spec/unit/plugins/chef_spec.rb +1 -2
- data/spec/unit/plugins/cloud_spec.rb +210 -50
- data/spec/unit/plugins/darwin/cpu_spec.rb +1 -1
- data/spec/unit/plugins/darwin/filesystem_spec.rb +62 -13
- data/spec/unit/plugins/darwin/hardware_spec.rb +2 -2
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -1
- data/spec/unit/plugins/darwin/kernel_spec.rb +1 -1
- data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
- data/spec/unit/plugins/darwin/network_spec.rb +1 -1
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -1
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +2 -9
- data/spec/unit/plugins/darwin/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/digital_ocean_spec.rb +39 -110
- data/spec/unit/plugins/dmi_spec.rb +1 -1
- data/spec/unit/plugins/ec2_spec.rb +10 -62
- data/spec/unit/plugins/elixir_spec.rb +1 -1
- data/spec/unit/plugins/erlang_spec.rb +1 -1
- data/spec/unit/plugins/eucalyptus_spec.rb +1 -1
- data/spec/unit/plugins/fail_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/cpu_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/os_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/gce_spec.rb +1 -1
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -1
- data/spec/unit/plugins/haskell_spec.rb +1 -1
- data/spec/unit/plugins/hostname_spec.rb +16 -41
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/ip_scopes_spec.rb +18 -6
- data/spec/unit/plugins/java_spec.rb +1 -1
- data/spec/unit/plugins/joyent_spec.rb +17 -1
- data/spec/unit/plugins/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linode_spec.rb +1 -1
- data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
- data/spec/unit/plugins/linux/cpu_spec.rb +1 -2
- data/spec/unit/plugins/linux/filesystem_spec.rb +207 -201
- data/spec/unit/plugins/linux/fips_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +1 -1
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +1 -1
- data/spec/unit/plugins/linux/machineid_spec.rb +1 -1
- data/spec/unit/plugins/linux/mdadm_spec.rb +2 -68
- data/spec/unit/plugins/linux/memory_spec.rb +1 -1
- data/spec/unit/plugins/linux/network_spec.rb +3 -44
- data/spec/unit/plugins/linux/platform_spec.rb +4 -4
- data/spec/unit/plugins/linux/sessions_spec.rb +1 -1
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
- data/spec/unit/plugins/linux/virtualization_spec.rb +1 -28
- data/spec/unit/plugins/lua_spec.rb +1 -1
- data/spec/unit/plugins/mono_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +1 -1
- 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 -1
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/openstack_spec.rb +2 -3
- data/spec/unit/plugins/os_spec.rb +1 -1
- data/spec/unit/plugins/packages_spec.rb +1 -1
- data/spec/unit/plugins/passwd_spec.rb +17 -1
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +1 -1
- data/spec/unit/plugins/platform_spec.rb +1 -1
- data/spec/unit/plugins/powershell_spec.rb +1 -1
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +1 -2
- data/spec/unit/plugins/root_group_spec.rb +2 -2
- data/spec/unit/plugins/ruby_spec.rb +1 -1
- data/spec/unit/plugins/rust_spec.rb +1 -1
- data/spec/unit/plugins/scala_spec.rb +3 -37
- data/spec/unit/plugins/shard_spec.rb +1 -1
- data/spec/unit/plugins/shells_spec.rb +1 -1
- data/spec/unit/plugins/softlayer_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/cpu_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/dmi_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/memory_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +7 -4
- data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/zpools_spec.rb +1 -1
- data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
- data/spec/unit/plugins/sysconf_spec.rb +1 -1
- data/spec/unit/plugins/timezone_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +1 -1
- data/spec/unit/plugins/vmware_spec.rb +2 -1
- data/spec/unit/plugins/windows/cpu_spec.rb +9 -2
- data/spec/unit/plugins/windows/fips_spec.rb +1 -1
- data/spec/unit/plugins/windows/memory_spec.rb +1 -1
- data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
- data/spec/unit/provides_map_spec.rb +1 -1
- data/spec/unit/runner_spec.rb +1 -1
- data/spec/unit/system_spec.rb +68 -76
- data/spec/unit/util/file_helper_spec.rb +1 -1
- data/spec/unit/util/ip_helper_spec.rb +1 -1
- metadata +6 -20
- data/lib/ohai/plugins/cloud_v2.rb +0 -315
- data/lib/ohai/plugins/darwin/filesystem2.rb +0 -107
- data/lib/ohai/plugins/linux/filesystem2.rb +0 -223
- data/lib/ohai/plugins/linux/lspci.rb +0 -76
- data/lib/ohai/plugins/network_listeners.rb +0 -60
- data/lib/ohai/plugins/sigar/cpu.rb +0 -44
- data/lib/ohai/plugins/sigar/filesystem.rb +0 -50
- data/lib/ohai/plugins/sigar/memory.rb +0 -39
- data/lib/ohai/plugins/sigar/network.rb +0 -168
- data/lib/ohai/plugins/sigar/network_route.rb +0 -64
- data/lib/ohai/plugins/sigar/platform.rb +0 -30
- data/spec/unit/plugins/cloud_v2_spec.rb +0 -389
- data/spec/unit/plugins/darwin/filesystem2_spec.rb +0 -139
- data/spec/unit/plugins/linux/filesystem2_spec.rb +0 -437
- data/spec/unit/plugins/linux/lspci_spec.rb +0 -133
- data/spec/unit/plugins/sigar/network_route_spec.rb +0 -148
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require_relative "../../../spec_helper.rb"
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux hostnamectl plugin" do
|
22
22
|
let(:plugin) { get_plugin("linux/hostnamectl") }
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require_relative "../../../spec_helper.rb"
|
20
20
|
|
21
21
|
describe Ohai::System, "Machine id plugin" do
|
22
22
|
let(:plugin) { get_plugin("linux/machineid") }
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require_relative "../../../spec_helper.rb"
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux Mdadm Plugin" do
|
22
22
|
before(:each) do
|
@@ -99,72 +99,6 @@ MD
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
it "should detect member devies" do
|
103
|
-
@plugin.run
|
104
|
-
expect(@plugin[:mdadm][:md0][:members].sort).to eq(
|
105
|
-
%w{sdc sdd sde sdf sdg sdh}
|
106
|
-
)
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should detect member devices even if there are multi-digit numbers" do
|
110
|
-
new_mdstat = double("/proc/mdstat2")
|
111
|
-
allow(new_mdstat).to receive(:each).
|
112
|
-
and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]").
|
113
|
-
and_yield("md0 : active raid10 sdj[2010] sdi[99] sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]").
|
114
|
-
and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
115
|
-
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
116
|
-
|
117
|
-
@plugin.run
|
118
|
-
expect(@plugin[:mdadm][:md0][:members].sort).to eq(
|
119
|
-
%w{sdc sdd sde sdf sdg sdh sdi sdj}
|
120
|
-
)
|
121
|
-
end
|
122
|
-
|
123
|
-
it "should detect member devices even if mdstat has extra entries" do
|
124
|
-
new_mdstat = double("/proc/mdstat2")
|
125
|
-
allow(new_mdstat).to receive(:each).
|
126
|
-
and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]").
|
127
|
-
and_yield("md0 : active (somecraphere) <morestuff> raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]").
|
128
|
-
and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
129
|
-
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
130
|
-
|
131
|
-
@plugin.run
|
132
|
-
expect(@plugin[:mdadm][:md0][:members].sort).to eq(
|
133
|
-
%w{sdc sdd sde sdf sdg sdh}
|
134
|
-
)
|
135
|
-
end
|
136
|
-
|
137
|
-
it "should accurately report inactive arrays" do
|
138
|
-
new_mdstat = double("/proc/mdstat_inactive")
|
139
|
-
allow(new_mdstat).to receive(:each).
|
140
|
-
and_yield("Personalities :").
|
141
|
-
and_yield("md0 : inactive nvme2n1p3[2](S)")
|
142
|
-
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
143
|
-
|
144
|
-
@plugin.run
|
145
|
-
expect(@plugin[:mdadm][:md0][:spares]).to eq(%w{nvme2n1p3})
|
146
|
-
end
|
147
|
-
|
148
|
-
it "should report journal devices" do
|
149
|
-
new_mdstat = double("/proc/mdstat_journal")
|
150
|
-
allow(new_mdstat).to receive(:each).
|
151
|
-
and_yield("Personalies : [raid6]").
|
152
|
-
and_yield("md0 : active (somecraphere) <morestuff raid6 sdbc1[7] sdd1[6] sde1[5] sdd1[4] sde1[3] sdf1[2] sdg1[1] nvme2n1p3[0](J)")
|
153
|
-
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
154
|
-
|
155
|
-
@plugin.run
|
156
|
-
expect(@plugin[:mdadm][:md0][:journal]).to eq("nvme2n1p3")
|
157
|
-
end
|
158
|
-
|
159
|
-
it "should report spare devices" do
|
160
|
-
new_mdstat = double("/proc/mdstat_spare")
|
161
|
-
allow(new_mdstat).to receive(:each).
|
162
|
-
and_yield("Personalies : [raid6]").
|
163
|
-
and_yield("md0 : active (somecraphere) <morestuff raid6 sdbc1[7] sdd1[6] sde1[5] sdd1[4] sde1[3] sdf1[2] sdg1[1] sdh1[0](S)")
|
164
|
-
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
165
|
-
|
166
|
-
@plugin.run
|
167
|
-
expect(@plugin[:mdadm][:md0][:spares]).to eq(%w{sdh1})
|
168
|
-
end
|
169
102
|
end
|
103
|
+
|
170
104
|
end
|
@@ -17,14 +17,8 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
begin
|
23
|
-
require "ipaddress"
|
24
|
-
rescue LoadError => e
|
25
|
-
puts "The linux network plugin spec tests will fail without the 'ipaddress' library/gem.\n\n"
|
26
|
-
raise e
|
27
|
-
end
|
20
|
+
require_relative "../../../spec_helper.rb"
|
21
|
+
require "ipaddress"
|
28
22
|
|
29
23
|
describe Ohai::System, "Linux Network Plugin" do
|
30
24
|
let(:plugin) { get_plugin("linux/network") }
|
@@ -240,10 +234,6 @@ EOM
|
|
240
234
|
valid_lft forever preferred_lft forever
|
241
235
|
13: fwdintf: <MULTICAST,NOARP,UP,LOWER_UP> mtu 1496 qdisc pfifo_fast state UNKNOWN group default qlen 1000
|
242
236
|
link/ether 00:00:00:00:00:0a brd ff:ff:ff:ff:ff:ff
|
243
|
-
14: ip6tnl0@NONE: <NOARP,UP,LOWER_UP> mtu 1452 qdisc noqueue state UNKNOWN group default qlen 1
|
244
|
-
link/tunnel6 :: brd ::
|
245
|
-
inet6 fe80::f47a:2aff:fef0:c6ef/64 scope link
|
246
|
-
valid_lft forever preferred_lft forever
|
247
237
|
EOM
|
248
238
|
end
|
249
239
|
|
@@ -304,13 +294,6 @@ EOM
|
|
304
294
|
0 0 0 0 0 0
|
305
295
|
TX: bytes packets errors dropped carrier collsns
|
306
296
|
140 2 0 1 0 0
|
307
|
-
14: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1
|
308
|
-
link/tunnel6 :: brd :: promiscuity 0
|
309
|
-
ip6tnl ip6ip6 remote :: local :: encaplimit 0 hoplimit 0 tclass 0x00 flowlabel 0x00000 (flowinfo 0x00000000) addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
|
310
|
-
RX: bytes packets errors dropped overrun mcast
|
311
|
-
0 0 0 0 0 0
|
312
|
-
TX: bytes packets errors dropped carrier collsns
|
313
|
-
0 0 0 0 0 0
|
314
297
|
EOM
|
315
298
|
end
|
316
299
|
|
@@ -583,11 +566,7 @@ EOM
|
|
583
566
|
end
|
584
567
|
|
585
568
|
it "detects the interfaces" do
|
586
|
-
|
587
|
-
expect(plugin["network"]["interfaces"].keys.sort).to eq(["eth0", "eth0.11", "eth0.151", "eth0.152", "eth0.153", "eth0:5", "eth3", "foo:veth0@eth0", "fwdintf", "ip6tnl0", "lo", "ovs-system", "tun0", "venet0", "venet0:0", "xapi1"])
|
588
|
-
else
|
589
|
-
expect(plugin["network"]["interfaces"].keys.sort).to eq(["eth0", "eth0.11", "eth0.151", "eth0.152", "eth0.153", "eth0:5", "eth3", "foo:veth0@eth0", "fwdintf", "lo", "ovs-system", "tun0", "venet0", "venet0:0", "xapi1"])
|
590
|
-
end
|
569
|
+
expect(plugin["network"]["interfaces"].keys.sort).to eq(["eth0", "eth0.11", "eth0.151", "eth0.152", "eth0.153", "eth0:5", "eth3", "foo:veth0@eth0", "fwdintf", "lo", "ovs-system", "tun0", "venet0", "venet0:0", "xapi1"])
|
591
570
|
end
|
592
571
|
|
593
572
|
it "detects the layer one details of an ethernet interface" do
|
@@ -691,26 +670,6 @@ EOM
|
|
691
670
|
expect(plugin["network"]["interfaces"]["eth0"]["arp"]["10.116.201.1"]).to eq("fe:ff:ff:ff:ff:ff")
|
692
671
|
end
|
693
672
|
|
694
|
-
if network_method == "iproute2"
|
695
|
-
it "detects the tunnel information" do
|
696
|
-
expect(plugin["network"]["interfaces"]["ip6tnl0"]["tunnel_info"]).to eq(
|
697
|
-
{
|
698
|
-
"proto" => "ip6ip6",
|
699
|
-
"remote" => "::",
|
700
|
-
"local" => "::",
|
701
|
-
"encaplimit" => "0",
|
702
|
-
"hoplimit" => "0",
|
703
|
-
"tclass" => "0x00",
|
704
|
-
"flowlabel" => "0x00000",
|
705
|
-
"addrgenmode" => "eui64",
|
706
|
-
"numtxqueues" => "1",
|
707
|
-
"numrxqueues" => "1",
|
708
|
-
"gso_max_size" => "65536",
|
709
|
-
"gso_max_segs" => "65535",
|
710
|
-
}
|
711
|
-
)
|
712
|
-
end
|
713
|
-
end
|
714
673
|
end
|
715
674
|
|
716
675
|
describe "gathering interface counters via #{network_method}" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) 2008-
|
3
|
+
# Copyright:: Copyright (c) 2008-2017, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require_relative "../../../spec_helper.rb"
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux plugin platform" do
|
22
22
|
|
@@ -113,7 +113,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
113
113
|
@plugin[:lsb][:release] = "2011.09"
|
114
114
|
@plugin.run
|
115
115
|
expect(@plugin[:platform]).to eq("amazon")
|
116
|
-
expect(@plugin[:platform_family]).to eq("
|
116
|
+
expect(@plugin[:platform_family]).to eq("amazon")
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should set platform to scientific when [:lsb][:id] contains ScientificSL" do
|
@@ -358,7 +358,7 @@ OS_RELEASE
|
|
358
358
|
it "should set the platform_family to rhel if the LSB name is amazon-ish" do
|
359
359
|
@plugin[:lsb][:id] = "Amazon"
|
360
360
|
@plugin.run
|
361
|
-
expect(@plugin[:platform_family]).to eq("
|
361
|
+
expect(@plugin[:platform_family]).to eq("amazon")
|
362
362
|
end
|
363
363
|
|
364
364
|
it "should set the platform_family to fedora if the LSB name is fedora-ish" do
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require_relative "../../../spec_helper.rb"
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux sessions plugin" do
|
22
22
|
let(:plugin) { get_plugin("linux/sessions") }
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require_relative "../../../spec_helper.rb"
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux virtualization platform" do
|
22
22
|
let(:plugin) { get_plugin("linux/virtualization") }
|
@@ -43,7 +43,6 @@ describe Ohai::System, "Linux virtualization platform" do
|
|
43
43
|
|
44
44
|
# default the which wrappers to nil
|
45
45
|
allow(plugin).to receive(:lxc_version_exists?).and_return(false)
|
46
|
-
allow(plugin).to receive(:docker_exists?).and_return(false)
|
47
46
|
allow(plugin).to receive(:nova_exists?).and_return(false)
|
48
47
|
end
|
49
48
|
|
@@ -649,30 +648,6 @@ CGROUP
|
|
649
648
|
expect(plugin[:virtualization][:systems][:docker]).to eq("guest")
|
650
649
|
end
|
651
650
|
|
652
|
-
it "sets docker guest if /proc/self/cgroup exist and there are /docker/docker-ce/<hexadecimal> mounts" do
|
653
|
-
self_cgroup = <<-CGROUP
|
654
|
-
13:name=systemd:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
655
|
-
12:pids:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
656
|
-
11:hugetlb:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
657
|
-
10:net_prio:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
658
|
-
9:perf_event:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
659
|
-
8:net_cls:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
660
|
-
7:freezer:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
661
|
-
6:devices:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
662
|
-
5:memory:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
663
|
-
4:blkio:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
664
|
-
3:cpuacct:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
665
|
-
2:cpu:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
666
|
-
1:cpuset:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
667
|
-
CGROUP
|
668
|
-
allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
669
|
-
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
670
|
-
plugin.run
|
671
|
-
expect(plugin[:virtualization][:system]).to eq("docker")
|
672
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
673
|
-
expect(plugin[:virtualization][:systems][:docker]).to eq("guest")
|
674
|
-
end
|
675
|
-
|
676
651
|
# Relevant at least starting docker 1.6.2, kernel 4.0.5 & systemd 224-1.
|
677
652
|
# Doi not exactly know which software/version really matters here.
|
678
653
|
it "should set docker guest if /proc/self/cgroup exists and there are /system.slice/docker-<hexadecimal> mounts (systemd managed cgroup)" do
|
@@ -732,7 +707,6 @@ CGROUP
|
|
732
707
|
end
|
733
708
|
|
734
709
|
it "does not set the old virtualization attributes if they are already set" do
|
735
|
-
allow(plugin).to receive(:docker_exists?).and_return("/usr/bin/docker")
|
736
710
|
plugin[:virtualization] = Mash.new
|
737
711
|
plugin[:virtualization][:system] = "the cloud"
|
738
712
|
plugin[:virtualization][:role] = "cumulonimbus"
|
@@ -742,7 +716,6 @@ CGROUP
|
|
742
716
|
end
|
743
717
|
|
744
718
|
it "does not set docker host if docker does not exist" do
|
745
|
-
allow(plugin).to receive(:docker_exists?).and_return(false)
|
746
719
|
plugin.run
|
747
720
|
expect(plugin[:virtualization][:system]).to be_nil
|
748
721
|
expect(plugin[:virtualization][:role]).to be_nil
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require_relative "../../spec_helper.rb"
|
20
20
|
|
21
21
|
describe Ohai::System, "plugin mono" do
|
22
22
|
let(:plugin) { get_plugin("mono") }
|