ohai 15.2.5 → 15.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ohai/application.rb +2 -2
- data/lib/ohai/mixin/dmi_decode.rb +4 -1
- data/lib/ohai/plugins/linux/sysctl.rb +38 -0
- data/lib/ohai/plugins/linux/virtualization.rb +11 -10
- data/lib/ohai/plugins/openstack.rb +8 -3
- data/lib/ohai/plugins/passwd.rb +4 -0
- data/lib/ohai/version.rb +1 -1
- data/spec/functional/application_spec.rb +5 -5
- data/spec/functional/loader_spec.rb +2 -2
- data/spec/functional/plugins/powershell_spec.rb +11 -5
- data/spec/functional/plugins/root_group_spec.rb +1 -1
- data/spec/functional/plugins/windows/uptime_spec.rb +3 -3
- data/spec/ohai_spec.rb +1 -1
- data/spec/spec_helper.rb +8 -8
- data/spec/support/integration_helper.rb +3 -3
- data/spec/unit/application_spec.rb +5 -5
- data/spec/unit/dsl/plugin_spec.rb +8 -7
- data/spec/unit/mixin/command_spec.rb +2 -2
- data/spec/unit/mixin/dmi_decode.rb +8 -1
- data/spec/unit/plugins/abort_spec.rb +4 -4
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/aix/hostname_spec.rb +2 -2
- data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
- data/spec/unit/plugins/aix/memory_spec.rb +5 -5
- data/spec/unit/plugins/aix/network_spec.rb +4 -1
- data/spec/unit/plugins/aix/platform_spec.rb +4 -4
- data/spec/unit/plugins/aix/uptime_spec.rb +3 -3
- data/spec/unit/plugins/aix/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/azure_spec.rb +8 -8
- data/spec/unit/plugins/bsd/filesystem_spec.rb +17 -16
- data/spec/unit/plugins/bsd/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/c_spec.rb +6 -5
- data/spec/unit/plugins/chef_spec.rb +2 -2
- data/spec/unit/plugins/cloud_spec.rb +4 -4
- data/spec/unit/plugins/darwin/cpu_spec.rb +11 -11
- data/spec/unit/plugins/darwin/filesystem_spec.rb +14 -13
- data/spec/unit/plugins/darwin/hardware_spec.rb +2 -1
- data/spec/unit/plugins/darwin/hostname_spec.rb +3 -3
- data/spec/unit/plugins/darwin/kernel_spec.rb +5 -5
- data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
- data/spec/unit/plugins/darwin/network_spec.rb +3 -3
- data/spec/unit/plugins/darwin/platform_spec.rb +9 -9
- data/spec/unit/plugins/darwin/virtualization_spec.rb +10 -10
- data/spec/unit/plugins/digital_ocean_spec.rb +14 -12
- data/spec/unit/plugins/dmi_spec.rb +1 -1
- data/spec/unit/plugins/docker_spec.rb +2 -2
- data/spec/unit/plugins/ec2_spec.rb +41 -30
- data/spec/unit/plugins/elixir_spec.rb +2 -2
- data/spec/unit/plugins/erlang_spec.rb +1 -1
- data/spec/unit/plugins/eucalyptus_spec.rb +17 -13
- data/spec/unit/plugins/fail_spec.rb +15 -15
- data/spec/unit/plugins/freebsd/cpu_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/platform_spec.rb +3 -3
- data/spec/unit/plugins/gce_spec.rb +9 -7
- data/spec/unit/plugins/go_spec.rb +2 -2
- data/spec/unit/plugins/groovy_spec.rb +1 -1
- data/spec/unit/plugins/haskell_spec.rb +10 -10
- data/spec/unit/plugins/hostname_spec.rb +15 -14
- data/spec/unit/plugins/init_package_spec.rb +4 -4
- data/spec/unit/plugins/java_spec.rb +7 -3
- data/spec/unit/plugins/joyent_spec.rb +4 -4
- data/spec/unit/plugins/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/block_device_spec.rb +2 -2
- data/spec/unit/plugins/linux/cpu_spec.rb +9 -8
- data/spec/unit/plugins/linux/filesystem_spec.rb +36 -35
- data/spec/unit/plugins/linux/fips_spec.rb +7 -5
- data/spec/unit/plugins/linux/hostname_spec.rb +4 -4
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +3 -3
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
- data/spec/unit/plugins/linux/lspci_spec.rb +2 -1
- data/spec/unit/plugins/linux/machineid_spec.rb +3 -3
- data/spec/unit/plugins/linux/mdadm_spec.rb +13 -13
- data/spec/unit/plugins/linux/memory_spec.rb +39 -39
- data/spec/unit/plugins/linux/network_spec.rb +20 -19
- data/spec/unit/plugins/linux/platform_spec.rb +60 -57
- data/spec/unit/plugins/linux/sessions_spec.rb +3 -3
- data/spec/unit/plugins/linux/sysctl_spec.rb +53 -0
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +3 -3
- data/spec/unit/plugins/linux/uptime_spec.rb +5 -5
- data/spec/unit/plugins/linux/virtualization_spec.rb +4 -4
- 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 +3 -3
- data/spec/unit/plugins/netbsd/kernel_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +3 -3
- data/spec/unit/plugins/network_spec.rb +3 -3
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +2 -2
- data/spec/unit/plugins/ohai_time_spec.rb +4 -4
- data/spec/unit/plugins/openbsd/hostname_spec.rb +3 -3
- data/spec/unit/plugins/openbsd/kernel_spec.rb +2 -2
- data/spec/unit/plugins/openbsd/platform_spec.rb +2 -2
- data/spec/unit/plugins/openstack_spec.rb +13 -8
- data/spec/unit/plugins/os_spec.rb +12 -12
- data/spec/unit/plugins/packages_spec.rb +10 -7
- data/spec/unit/plugins/passwd_spec.rb +18 -19
- 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 +7 -7
- data/spec/unit/plugins/powershell_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +25 -20
- data/spec/unit/plugins/root_group_spec.rb +14 -10
- data/spec/unit/plugins/ruby_spec.rb +2 -2
- data/spec/unit/plugins/rust_spec.rb +3 -3
- data/spec/unit/plugins/scala_spec.rb +2 -2
- data/spec/unit/plugins/scaleway_spec.rb +14 -12
- data/spec/unit/plugins/scsi_spec.rb +2 -1
- data/spec/unit/plugins/shard_spec.rb +18 -16
- data/spec/unit/plugins/solaris2/cpu_spec.rb +29 -29
- data/spec/unit/plugins/solaris2/dmi_spec.rb +4 -4
- data/spec/unit/plugins/solaris2/filesystem.rb +3 -3
- data/spec/unit/plugins/solaris2/hostname_spec.rb +2 -2
- data/spec/unit/plugins/solaris2/kernel_spec.rb +4 -4
- data/spec/unit/plugins/solaris2/memory_spec.rb +4 -4
- data/spec/unit/plugins/solaris2/platform_spec.rb +9 -9
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +6 -6
- data/spec/unit/plugins/ssh_host_keys_spec.rb +4 -1
- data/spec/unit/plugins/sysconf_spec.rb +2 -2
- data/spec/unit/plugins/timezone_spec.rb +2 -2
- data/spec/unit/plugins/virtualbox_spec.rb +10 -10
- data/spec/unit/plugins/vmware_spec.rb +4 -4
- data/spec/unit/plugins/windows/cpu_spec.rb +13 -13
- data/spec/unit/plugins/windows/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/windows/fips_spec.rb +7 -5
- data/spec/unit/plugins/windows/kernel_spec.rb +1 -1
- data/spec/unit/plugins/windows/memory_spec.rb +4 -4
- data/spec/unit/plugins/windows/network_spec.rb +1 -1
- data/spec/unit/plugins/windows/system_enclosure_spec.rb +2 -2
- data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/zpools_spec.rb +2 -0
- data/spec/unit/provides_map_spec.rb +18 -18
- data/spec/unit/runner_spec.rb +29 -29
- data/spec/unit/system_spec.rb +13 -13
- data/spec/unit/util/file_helper_spec.rb +1 -1
- data/spec/unit/util/ip_helper_spec.rb +6 -6
- metadata +4 -2
@@ -19,7 +19,7 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "plugin kernel" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@plugin = get_plugin("kernel")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:default) # for debugging
|
25
25
|
allow(@plugin).to receive(:shell_out).with("uname -s").and_return(mock_shell_out(0, "Darwin\n", ""))
|
@@ -41,7 +41,7 @@ describe Ohai::System, "Linux Block Device Plugin" do
|
|
41
41
|
tmp_double
|
42
42
|
end
|
43
43
|
|
44
|
-
before
|
44
|
+
before do
|
45
45
|
@plugin = get_plugin("linux/block_device")
|
46
46
|
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
47
47
|
|
@@ -66,7 +66,7 @@ describe Ohai::System, "Linux Block Device Plugin" do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
it "
|
69
|
+
it "collects all relevant data from disks" do
|
70
70
|
@plugin.run
|
71
71
|
DISKS.each do |disk, checks|
|
72
72
|
expect(@plugin[:block_device][disk.to_sym]).to include(checks)
|
@@ -86,12 +86,12 @@ describe Ohai::System, "General Linux cpu plugin" do
|
|
86
86
|
tempfile
|
87
87
|
end
|
88
88
|
|
89
|
-
before
|
89
|
+
before do
|
90
90
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
91
91
|
allow(File).to receive(:open).with("/proc/cpuinfo").and_return(tempfile_handle)
|
92
92
|
end
|
93
93
|
|
94
|
-
after
|
94
|
+
after do
|
95
95
|
|
96
96
|
tempfile.close
|
97
97
|
tempfile.unlink
|
@@ -154,15 +154,15 @@ describe Ohai::System, "General Linux cpu plugin" do
|
|
154
154
|
EOF
|
155
155
|
end
|
156
156
|
|
157
|
-
|
158
|
-
|
159
|
-
before(:each) do
|
157
|
+
before do
|
160
158
|
allow(plugin).to receive(:shell_out).with("lscpu").and_return(mock_shell_out(0, lscpu, ""))
|
161
159
|
end
|
162
160
|
|
161
|
+
it_behaves_like "Common cpu info", 1, 1
|
162
|
+
|
163
163
|
it "gets total cores" do
|
164
164
|
plugin.run
|
165
|
-
expect(plugin[:cpu][:cores]).to
|
165
|
+
expect(plugin[:cpu][:cores]).to be(1)
|
166
166
|
end
|
167
167
|
|
168
168
|
it "doesn't have a cpu 1" do
|
@@ -233,6 +233,7 @@ describe Ohai::System, "General Linux cpu plugin" do
|
|
233
233
|
expect(plugin[:cpu]["0"]["flags"]).to eq(%w{fpu pse tsc msr mce cx8 sep mtrr pge cmov})
|
234
234
|
end
|
235
235
|
end
|
236
|
+
|
236
237
|
context "with a dual-core hyperthreaded /proc/cpuinfo" do
|
237
238
|
let(:cpuinfo_contents) do
|
238
239
|
<<~EOF
|
@@ -363,7 +364,7 @@ end
|
|
363
364
|
describe Ohai::System, "S390 linux cpu plugin" do
|
364
365
|
let(:plugin) { get_plugin("cpu") }
|
365
366
|
|
366
|
-
before
|
367
|
+
before do
|
367
368
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
368
369
|
allow(plugin).to receive(:shell_out).with("lscpu").and_return(mock_shell_out(1, "", ""))
|
369
370
|
|
@@ -410,7 +411,7 @@ end
|
|
410
411
|
describe Ohai::System, "arm64 linux cpu plugin" do
|
411
412
|
let(:plugin) { get_plugin("cpu") }
|
412
413
|
|
413
|
-
before
|
414
|
+
before do
|
414
415
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
415
416
|
allow(plugin).to receive(:shell_out).with("lscpu").and_return(mock_shell_out(1, "", ""))
|
416
417
|
|
@@ -20,7 +20,8 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux filesystem plugin" do
|
22
22
|
let(:plugin) { get_plugin("filesystem") }
|
23
|
-
|
23
|
+
|
24
|
+
before do
|
24
25
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
25
26
|
|
26
27
|
allow(plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, "", ""))
|
@@ -56,7 +57,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
56
57
|
end
|
57
58
|
|
58
59
|
describe "when gathering filesystem usage data from df" do
|
59
|
-
before
|
60
|
+
before do
|
60
61
|
@stdout = <<~DF
|
61
62
|
Filesystem 1024-blocks Used Available Capacity Mounted on
|
62
63
|
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
|
@@ -83,55 +84,55 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
83
84
|
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
84
85
|
end
|
85
86
|
|
86
|
-
it "
|
87
|
+
it "runs df -P and df -iP" do
|
87
88
|
expect(plugin).to receive(:shell_out).ordered.with("df -P").and_return(mock_shell_out(0, @stdout, ""))
|
88
89
|
expect(plugin).to receive(:shell_out).ordered.with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
89
90
|
plugin.run
|
90
91
|
end
|
91
92
|
|
92
|
-
it "
|
93
|
+
it "sets kb_size to value from df -P" do
|
93
94
|
plugin.run
|
94
95
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:kb_size]).to eq("97605057")
|
95
96
|
end
|
96
97
|
|
97
|
-
it "
|
98
|
+
it "sets kb_used to value from df -P" do
|
98
99
|
plugin.run
|
99
100
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:kb_used]).to eq("53563253")
|
100
101
|
end
|
101
102
|
|
102
|
-
it "
|
103
|
+
it "sets kb_available to value from df -P" do
|
103
104
|
plugin.run
|
104
105
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:kb_available]).to eq("44041805")
|
105
106
|
end
|
106
107
|
|
107
|
-
it "
|
108
|
+
it "sets percent_used to value from df -P" do
|
108
109
|
plugin.run
|
109
110
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:percent_used]).to eq("56%")
|
110
111
|
end
|
111
112
|
|
112
|
-
it "
|
113
|
+
it "sets mount to value from df -P" do
|
113
114
|
plugin.run
|
114
115
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
|
115
116
|
end
|
116
117
|
|
117
|
-
it "
|
118
|
+
it "sets total_inodes to value from df -iP" do
|
118
119
|
plugin.run
|
119
120
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:total_inodes]).to eq("124865")
|
120
121
|
end
|
121
122
|
|
122
|
-
it "
|
123
|
+
it "sets inodes_used to value from df -iP" do
|
123
124
|
plugin.run
|
124
125
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:inodes_used]).to eq("380")
|
125
126
|
end
|
126
127
|
|
127
|
-
it "
|
128
|
+
it "sets inodes_available to value from df -iP" do
|
128
129
|
plugin.run
|
129
130
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:inodes_available]).to eq("124485")
|
130
131
|
end
|
131
132
|
end
|
132
133
|
|
133
134
|
describe "when gathering mounted filesystem data from mount" do
|
134
|
-
before
|
135
|
+
before do
|
135
136
|
@stdout = <<~MOUNT
|
136
137
|
/dev/mapper/sys.vg-root.lv on / type ext4 (rw,noatime,errors=remount-ro)
|
137
138
|
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
|
@@ -152,29 +153,29 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
152
153
|
allow(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
|
153
154
|
end
|
154
155
|
|
155
|
-
it "
|
156
|
+
it "runs mount" do
|
156
157
|
expect(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @stdout, ""))
|
157
158
|
plugin.run
|
158
159
|
end
|
159
160
|
|
160
|
-
it "
|
161
|
+
it "sets mount to value from mount" do
|
161
162
|
plugin.run
|
162
163
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
|
163
164
|
end
|
164
165
|
|
165
|
-
it "
|
166
|
+
it "sets fs_type to value from mount" do
|
166
167
|
plugin.run
|
167
168
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:fs_type]).to eq("xfs")
|
168
169
|
end
|
169
170
|
|
170
|
-
it "
|
171
|
+
it "sets mount_options to an array of values from mount" do
|
171
172
|
plugin.run
|
172
173
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(%w{ro noatime})
|
173
174
|
end
|
174
175
|
end
|
175
176
|
|
176
177
|
describe "when gathering filesystem type data from blkid" do
|
177
|
-
before
|
178
|
+
before do
|
178
179
|
# blkid and lsblk output are coorelated with df/mount output, so the
|
179
180
|
# most full test of them actually requires we have both
|
180
181
|
@dfstdout = <<~DF
|
@@ -219,11 +220,11 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
219
220
|
allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
|
220
221
|
end
|
221
222
|
|
222
|
-
it "
|
223
|
+
it "runs blkid" do
|
223
224
|
plugin.run
|
224
225
|
end
|
225
226
|
|
226
|
-
it "
|
227
|
+
it "sets kb_size to value from blkid" do
|
227
228
|
plugin.run
|
228
229
|
expect(plugin[:filesystem]["by_pair"]["/dev/md1,"][:fs_type]).to eq("LVM2_member")
|
229
230
|
expect(plugin[:filesystem]["by_pair"]["/dev/sda2,"][:uuid]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
|
@@ -232,7 +233,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
232
233
|
end
|
233
234
|
|
234
235
|
describe "when gathering filesystem type data from lsblk" do
|
235
|
-
before
|
236
|
+
before do
|
236
237
|
@dfstdout = <<~DF
|
237
238
|
Filesystem 1024-blocks Used Available Capacity Mounted on
|
238
239
|
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
|
@@ -280,18 +281,18 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
280
281
|
.and_return(mock_shell_out(0, @stdout, ""))
|
281
282
|
end
|
282
283
|
|
283
|
-
it "
|
284
|
+
it "runs lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
|
284
285
|
plugin.run
|
285
286
|
end
|
286
287
|
|
287
|
-
it "
|
288
|
+
it "sets kb_size to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
|
288
289
|
plugin.run
|
289
290
|
expect(plugin[:filesystem]["by_pair"]["/dev/md1,"][:fs_type]).to eq("LVM2_member")
|
290
291
|
expect(plugin[:filesystem]["by_pair"]["/dev/sda2,"][:uuid]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
|
291
292
|
expect(plugin[:filesystem]["by_pair"]["/dev/md0,/boot"][:label]).to eq("/boot")
|
292
293
|
end
|
293
294
|
|
294
|
-
it "
|
295
|
+
it "ignores extra info in name and set label to value from lsblk -n -P -o NAME,UUID,LABEL,FSTYPE" do
|
295
296
|
plugin.run
|
296
297
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/debian--7-root,"][:label]).to eq("root")
|
297
298
|
end
|
@@ -299,7 +300,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
299
300
|
end
|
300
301
|
|
301
302
|
describe "when gathering filesystem type data from both lsblk and blkid" do
|
302
|
-
before
|
303
|
+
before do
|
303
304
|
@dfstdout = <<~DF
|
304
305
|
Filesystem 1024-blocks Used Available Capacity Mounted on
|
305
306
|
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
|
@@ -362,21 +363,21 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
362
363
|
allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
|
363
364
|
end
|
364
365
|
|
365
|
-
it "
|
366
|
+
it "fills in missing FS data from lsblk using blkid" do
|
366
367
|
plugin.run
|
367
368
|
pairs = plugin[:filesystem]["by_pair"]
|
368
369
|
expect(pairs["/dev/mapper/sys.vg-root.lv,/"]["fs_type"]).to eq("ext4")
|
369
370
|
expect(pairs["/dev/mapper/sys.vg-usr.lv,/usr"]["fs_type"]).to eq("ext4")
|
370
371
|
end
|
371
372
|
|
372
|
-
it "
|
373
|
+
it "fills in missing FS data from blkid using lsblk" do
|
373
374
|
plugin.run
|
374
375
|
pairs = plugin[:filesystem]["by_pair"]
|
375
376
|
expect(pairs["/dev/sdb1,"]["uuid"]).to eq("bd1197e0-6997-1f3a-e27e-7801388308b5")
|
376
377
|
expect(pairs["/dev/sdb2,"]["uuid"]).to eq("e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa")
|
377
378
|
end
|
378
379
|
|
379
|
-
it "
|
380
|
+
it "prefers lsblk data to blkid data when they conflict" do
|
380
381
|
plugin.run
|
381
382
|
pairs = plugin[:filesystem]["by_pair"]
|
382
383
|
expect(pairs["/dev/mapper/sys.vg-home.lv,/home"]["label"]).to eq("/home")
|
@@ -385,7 +386,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
385
386
|
end
|
386
387
|
|
387
388
|
describe "when gathering data from /proc/mounts" do
|
388
|
-
before
|
389
|
+
before do
|
389
390
|
allow(File).to receive(:exist?).with("/proc/mounts").and_return(true)
|
390
391
|
@double_file = double("/proc/mounts")
|
391
392
|
@mounts = <<~MOUNTS
|
@@ -417,24 +418,24 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
417
418
|
allow(File).to receive(:open).with("/proc/mounts").and_return(@double_file)
|
418
419
|
end
|
419
420
|
|
420
|
-
it "
|
421
|
+
it "sets mount to value from /proc/mounts" do
|
421
422
|
plugin.run
|
422
423
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount]).to eq("/special")
|
423
424
|
end
|
424
425
|
|
425
|
-
it "
|
426
|
+
it "sets fs_type to value from /proc/mounts" do
|
426
427
|
plugin.run
|
427
428
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:fs_type]).to eq("xfs")
|
428
429
|
end
|
429
430
|
|
430
|
-
it "
|
431
|
+
it "sets mount_options to an array of values from /proc/mounts" do
|
431
432
|
plugin.run
|
432
433
|
expect(plugin[:filesystem]["by_pair"]["/dev/mapper/sys.vg-special.lv,/special"][:mount_options]).to eq(%w{ro noatime attr2 noquota})
|
433
434
|
end
|
434
435
|
end
|
435
436
|
|
436
437
|
describe "when gathering filesystem data with devices mounted more than once" do
|
437
|
-
before
|
438
|
+
before do
|
438
439
|
# there's a few different examples one can run into in this output:
|
439
440
|
# 1. A device physically mounted in more than one place: /home and /home2
|
440
441
|
# 2. A bind-mounted directory, which shows up as the same device in a
|
@@ -475,7 +476,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
475
476
|
.and_return(mock_shell_out(0, @stdout, ""))
|
476
477
|
end
|
477
478
|
|
478
|
-
it "
|
479
|
+
it "provides a devices view with all mountpoints" do
|
479
480
|
plugin.run
|
480
481
|
expect(plugin[:filesystem]["by_device"]["/dev/mapper/sys.vg-root.lv"][:mounts]).to eq(["/", "/var/chroot"])
|
481
482
|
expect(plugin[:filesystem]["by_device"]["/dev/mapper/sys.vg-home.lv"][:mounts]).to eq(["/home", "/home2"])
|
@@ -484,7 +485,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
484
485
|
end
|
485
486
|
|
486
487
|
describe "when gathering filesystem data with double-mounts" do
|
487
|
-
before
|
488
|
+
before do
|
488
489
|
@dfstdout = <<~DF
|
489
490
|
Filesystem 1024-blocks Used Available Capacity Mounted on
|
490
491
|
/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /
|
@@ -522,7 +523,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
522
523
|
.and_return(mock_shell_out(0, @stdout, ""))
|
523
524
|
end
|
524
525
|
|
525
|
-
it "
|
526
|
+
it "provides a mounts view with all devices" do
|
526
527
|
plugin.run
|
527
528
|
expect(plugin[:filesystem]["by_mountpoint"]["/mnt"][:devices]).to eq(["/dev/sdb1", "/dev/sdc1"])
|
528
529
|
end
|
@@ -20,16 +20,16 @@ require "spec_helper"
|
|
20
20
|
require "openssl"
|
21
21
|
|
22
22
|
describe Ohai::System, "plugin fips" do
|
23
|
-
let(:enabled) { "0" }
|
24
|
-
let(:plugin) { get_plugin("linux/fips") }
|
25
|
-
let(:openssl_test_mode) { false }
|
26
|
-
|
27
23
|
subject do
|
28
24
|
plugin.run
|
29
25
|
plugin["fips"]["kernel"]["enabled"]
|
30
26
|
end
|
31
27
|
|
32
|
-
|
28
|
+
let(:enabled) { "0" }
|
29
|
+
let(:plugin) { get_plugin("linux/fips") }
|
30
|
+
let(:openssl_test_mode) { false }
|
31
|
+
|
32
|
+
before do
|
33
33
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
34
34
|
end
|
35
35
|
|
@@ -44,6 +44,7 @@ describe Ohai::System, "plugin fips" do
|
|
44
44
|
|
45
45
|
context "with OpenSSL.fips_mode == false" do
|
46
46
|
before { allow(OpenSSL).to receive(:fips_mode).and_return(false) }
|
47
|
+
|
47
48
|
it "does not set fips plugin" do
|
48
49
|
expect(subject).to be(false)
|
49
50
|
end
|
@@ -51,6 +52,7 @@ describe Ohai::System, "plugin fips" do
|
|
51
52
|
|
52
53
|
context "with OpenSSL.fips_mode == true" do
|
53
54
|
before { allow(OpenSSL).to receive(:fips_mode).and_return(true) }
|
55
|
+
|
54
56
|
it "sets fips plugin" do
|
55
57
|
expect(subject).to be(true)
|
56
58
|
end
|
@@ -19,7 +19,7 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux hostname plugin" do
|
22
|
-
before
|
22
|
+
before do
|
23
23
|
@plugin = get_plugin("hostname")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
25
25
|
allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
|
@@ -34,15 +34,15 @@ describe Ohai::System, "Linux hostname plugin" do
|
|
34
34
|
it_should_check_from("linux::hostname", "machinename", "hostname", "katie.local")
|
35
35
|
|
36
36
|
describe "when domain name is unset" do
|
37
|
-
before
|
37
|
+
before do
|
38
38
|
expect(@plugin).to receive(:shell_out).with("hostname --fqdn").and_raise("Ohai::Exception::Exec")
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "does not raise an error" do
|
42
42
|
expect { @plugin.run }.not_to raise_error
|
43
43
|
end
|
44
44
|
|
45
|
-
it "
|
45
|
+
it "does not set fqdn" do
|
46
46
|
@plugin.run
|
47
47
|
expect(@plugin.fqdn).to eq(nil)
|
48
48
|
end
|
@@ -21,11 +21,11 @@ require "spec_helper"
|
|
21
21
|
describe Ohai::System, "Linux hostnamectl plugin" do
|
22
22
|
let(:plugin) { get_plugin("linux/hostnamectl") }
|
23
23
|
|
24
|
-
before
|
24
|
+
before do
|
25
25
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "populates hostnamectl if hostnamectl is available" do
|
29
29
|
hostnamectl_out = <<-HOSTNAMECTL_OUT
|
30
30
|
Static hostname: foo
|
31
31
|
Icon name: computer-laptop
|
@@ -52,7 +52,7 @@ describe Ohai::System, "Linux hostnamectl plugin" do
|
|
52
52
|
})
|
53
53
|
end
|
54
54
|
|
55
|
-
it "
|
55
|
+
it "does not populate hostnamectl if hostnamectl is not available" do
|
56
56
|
allow(plugin).to receive(:which).with("hostnamectl").and_return(false)
|
57
57
|
expect(plugin[:hostnamectl]).to eq(nil)
|
58
58
|
end
|
@@ -21,13 +21,13 @@ require "spec_helper"
|
|
21
21
|
# We do not alter case for lsb attributes and consume them as provided
|
22
22
|
|
23
23
|
describe Ohai::System, "Linux lsb plugin" do
|
24
|
-
before
|
24
|
+
before do
|
25
25
|
@plugin = get_plugin("linux/lsb")
|
26
26
|
allow(@plugin).to receive(:collect_os).and_return(:linux)
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "on systems with /etc/lsb-release" do
|
30
|
-
before
|
30
|
+
before do
|
31
31
|
@double_file = double("/etc/lsb-release")
|
32
32
|
allow(@double_file).to receive(:each)
|
33
33
|
.and_yield("DISTRIB_ID=Ubuntu")
|
@@ -39,29 +39,29 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
39
39
|
allow(File).to receive(:exist?).with("/etc/lsb-release").and_return(true)
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
42
|
+
it "sets lsb[:id]" do
|
43
43
|
@plugin.run
|
44
44
|
expect(@plugin[:lsb][:id]).to eq("Ubuntu")
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
47
|
+
it "sets lsb[:release]" do
|
48
48
|
@plugin.run
|
49
49
|
expect(@plugin[:lsb][:release]).to eq("8.04")
|
50
50
|
end
|
51
51
|
|
52
|
-
it "
|
52
|
+
it "sets lsb[:codename]" do
|
53
53
|
@plugin.run
|
54
54
|
expect(@plugin[:lsb][:codename]).to eq("hardy")
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "sets lsb[:description]" do
|
58
58
|
@plugin.run
|
59
59
|
expect(@plugin[:lsb][:description]).to eq("Ubuntu 8.04")
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe "on systems with /usr/bin/lsb_release" do
|
64
|
-
before
|
64
|
+
before do
|
65
65
|
allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(true)
|
66
66
|
|
67
67
|
@stdin = double("STDIN", { close: true })
|
@@ -73,7 +73,7 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
describe "on Centos 5.4 correctly" do
|
76
|
-
before
|
76
|
+
before do
|
77
77
|
@stdout = <<~LSB_RELEASE
|
78
78
|
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
|
79
79
|
Distributor ID: CentOS
|
@@ -84,29 +84,29 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
84
84
|
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
|
85
85
|
end
|
86
86
|
|
87
|
-
it "
|
87
|
+
it "sets lsb[:id]" do
|
88
88
|
@plugin.run
|
89
89
|
expect(@plugin[:lsb][:id]).to eq("CentOS")
|
90
90
|
end
|
91
91
|
|
92
|
-
it "
|
92
|
+
it "sets lsb[:release]" do
|
93
93
|
@plugin.run
|
94
94
|
expect(@plugin[:lsb][:release]).to eq("5.4")
|
95
95
|
end
|
96
96
|
|
97
|
-
it "
|
97
|
+
it "sets lsb[:codename]" do
|
98
98
|
@plugin.run
|
99
99
|
expect(@plugin[:lsb][:codename]).to eq("Final")
|
100
100
|
end
|
101
101
|
|
102
|
-
it "
|
102
|
+
it "sets lsb[:description]" do
|
103
103
|
@plugin.run
|
104
104
|
expect(@plugin[:lsb][:description]).to eq("CentOS release 5.4 (Final)")
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
108
|
describe "on Fedora 14 correctly" do
|
109
|
-
before
|
109
|
+
before do
|
110
110
|
@stdout = <<~LSB_RELEASE
|
111
111
|
LSB Version: :core-4.0-ia32:core-4.0-noarch
|
112
112
|
Distributor ID: Fedora
|
@@ -117,29 +117,29 @@ describe Ohai::System, "Linux lsb plugin" do
|
|
117
117
|
allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
|
118
118
|
end
|
119
119
|
|
120
|
-
it "
|
120
|
+
it "sets lsb[:id]" do
|
121
121
|
@plugin.run
|
122
122
|
expect(@plugin[:lsb][:id]).to eq("Fedora")
|
123
123
|
end
|
124
124
|
|
125
|
-
it "
|
125
|
+
it "sets lsb[:release]" do
|
126
126
|
@plugin.run
|
127
127
|
expect(@plugin[:lsb][:release]).to eq("14")
|
128
128
|
end
|
129
129
|
|
130
|
-
it "
|
130
|
+
it "sets lsb[:codename]" do
|
131
131
|
@plugin.run
|
132
132
|
expect(@plugin[:lsb][:codename]).to eq("Laughlin")
|
133
133
|
end
|
134
134
|
|
135
|
-
it "
|
135
|
+
it "sets lsb[:description]" do
|
136
136
|
@plugin.run
|
137
137
|
expect(@plugin[:lsb][:description]).to eq("Fedora release 14 (Laughlin)")
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
it "
|
142
|
+
it "does not set any lsb values if /etc/lsb-release or /usr/bin/lsb_release do not exist " do
|
143
143
|
allow(File).to receive(:exist?).with("/etc/lsb-release").and_return(false)
|
144
144
|
allow(File).to receive(:exist?).with("/usr/bin/lsb_release").and_return(false)
|
145
145
|
expect(@plugin.attribute?(:lsb)).to be(false)
|