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
@@ -23,6 +23,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
23
23
|
|
24
24
|
describe "#read_os_release_info" do
|
25
25
|
let(:file_contents) { "COW=MOO\nDOG=\"BARK\"" }
|
26
|
+
|
26
27
|
it "returns nil if the file does not exist" do
|
27
28
|
allow(File).to receive(:exist?).with("/etc/test-release").and_return(false)
|
28
29
|
expect(plugin.read_os_release_info("/etc/test-release")).to be nil
|
@@ -211,7 +212,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
211
212
|
end
|
212
213
|
|
213
214
|
describe "on system with /etc/os-release" do
|
214
|
-
before
|
215
|
+
before do
|
215
216
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
216
217
|
allow(::File).to receive(:exist?).with("/etc/os-release").and_return(true)
|
217
218
|
end
|
@@ -228,11 +229,11 @@ describe Ohai::System, "Linux plugin platform" do
|
|
228
229
|
OS_DATA
|
229
230
|
end
|
230
231
|
|
231
|
-
before
|
232
|
+
before do
|
232
233
|
expect(File).to receive(:read).with("/etc/os-release").and_return(os_data)
|
233
234
|
end
|
234
235
|
|
235
|
-
it "
|
236
|
+
it "sets platform, platform_family, and platform_version from os-release" do
|
236
237
|
plugin.run
|
237
238
|
expect(plugin[:platform]).to eq("ubuntu")
|
238
239
|
expect(plugin[:platform_family]).to eq("debian")
|
@@ -250,11 +251,11 @@ describe Ohai::System, "Linux plugin platform" do
|
|
250
251
|
OS_DATA
|
251
252
|
end
|
252
253
|
|
253
|
-
before
|
254
|
+
before do
|
254
255
|
expect(File).to receive(:read).with("/etc/os-release").and_return(os_data)
|
255
256
|
end
|
256
257
|
|
257
|
-
it "
|
258
|
+
it "sets platform_version using kernel version from uname" do
|
258
259
|
allow(plugin).to receive(:shell_out).with("/bin/uname -r").and_return(mock_shell_out(0, "3.18.2-2-ARCH\n", ""))
|
259
260
|
plugin.run
|
260
261
|
expect(plugin[:platform]).to eq("arch")
|
@@ -275,11 +276,11 @@ describe Ohai::System, "Linux plugin platform" do
|
|
275
276
|
OS_DATA
|
276
277
|
end
|
277
278
|
|
278
|
-
before
|
279
|
+
before do
|
279
280
|
expect(File).to receive(:read).with("/etc/os-release").and_return(os_data)
|
280
281
|
end
|
281
282
|
|
282
|
-
it "
|
283
|
+
it "sets platform, platform_family, and platform_version from os-release" do
|
283
284
|
plugin.run
|
284
285
|
expect(plugin[:platform]).to eq("opensuseleap")
|
285
286
|
expect(plugin[:platform_family]).to eq("suse")
|
@@ -299,12 +300,12 @@ describe Ohai::System, "Linux plugin platform" do
|
|
299
300
|
OS_DATA
|
300
301
|
end
|
301
302
|
|
302
|
-
before
|
303
|
+
before do
|
303
304
|
expect(File).to receive(:read).with("/etc/os-release").and_return(os_data)
|
304
305
|
expect(File).to receive(:read).with("/etc/redhat-release").and_return("CentOS Linux release 7.5.1804 (Core)")
|
305
306
|
end
|
306
307
|
|
307
|
-
it "
|
308
|
+
it "sets platform, platform_family, and platform_version from os-release" do
|
308
309
|
plugin.run
|
309
310
|
expect(plugin[:platform]).to eq("centos")
|
310
311
|
expect(plugin[:platform_family]).to eq("rhel")
|
@@ -330,7 +331,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
330
331
|
let(:have_cisco_release) { false }
|
331
332
|
let(:have_f5_release) { false }
|
332
333
|
|
333
|
-
before
|
334
|
+
before do
|
334
335
|
allow(plugin).to receive(:collect_os).and_return(:linux)
|
335
336
|
plugin[:lsb] = Mash.new
|
336
337
|
allow(File).to receive(:exist?).with("/etc/debian_version").and_return(have_debian_version)
|
@@ -352,36 +353,36 @@ describe Ohai::System, "Linux plugin platform" do
|
|
352
353
|
end
|
353
354
|
|
354
355
|
describe "on lsb compliant distributions" do
|
355
|
-
before
|
356
|
+
before do
|
356
357
|
plugin[:lsb][:id] = "Ubuntu"
|
357
358
|
plugin[:lsb][:release] = "18.04"
|
358
359
|
end
|
359
360
|
|
360
|
-
it "
|
361
|
+
it "sets platform to lowercased lsb[:id]" do
|
361
362
|
plugin.run
|
362
363
|
expect(plugin[:platform]).to eq("ubuntu")
|
363
364
|
end
|
364
365
|
|
365
|
-
it "
|
366
|
+
it "sets platform_version to lsb[:release]" do
|
366
367
|
plugin.run
|
367
368
|
expect(plugin[:platform_version]).to eq("18.04")
|
368
369
|
end
|
369
370
|
|
370
|
-
it "
|
371
|
+
it "sets platform to ubuntu and platform_family to debian [:lsb][:id] contains Ubuntu" do
|
371
372
|
plugin[:lsb][:id] = "Ubuntu"
|
372
373
|
plugin.run
|
373
374
|
expect(plugin[:platform]).to eq("ubuntu")
|
374
375
|
expect(plugin[:platform_family]).to eq("debian")
|
375
376
|
end
|
376
377
|
|
377
|
-
it "
|
378
|
+
it "sets platform to debian and platform_family to debian [:lsb][:id] contains Debian" do
|
378
379
|
plugin[:lsb][:id] = "Debian"
|
379
380
|
plugin.run
|
380
381
|
expect(plugin[:platform]).to eq("debian")
|
381
382
|
expect(plugin[:platform_family]).to eq("debian")
|
382
383
|
end
|
383
384
|
|
384
|
-
it "
|
385
|
+
it "sets platform to redhat and platform_family to rhel when [:lsb][:id] contains Redhat" do
|
385
386
|
plugin[:lsb][:id] = "RedHatEnterpriseServer"
|
386
387
|
plugin[:lsb][:release] = "7.5"
|
387
388
|
plugin.run
|
@@ -389,7 +390,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
389
390
|
expect(plugin[:platform_family]).to eq("rhel")
|
390
391
|
end
|
391
392
|
|
392
|
-
it "
|
393
|
+
it "sets platform to amazon and platform_family to rhel when [:lsb][:id] contains Amazon" do
|
393
394
|
plugin[:lsb][:id] = "AmazonAMI"
|
394
395
|
plugin[:lsb][:release] = "2018.03"
|
395
396
|
plugin.run
|
@@ -397,14 +398,14 @@ describe Ohai::System, "Linux plugin platform" do
|
|
397
398
|
expect(plugin[:platform_family]).to eq("amazon")
|
398
399
|
end
|
399
400
|
|
400
|
-
it "
|
401
|
+
it "sets platform to scientific when [:lsb][:id] contains ScientificSL" do
|
401
402
|
plugin[:lsb][:id] = "ScientificSL"
|
402
403
|
plugin[:lsb][:release] = "7.5"
|
403
404
|
plugin.run
|
404
405
|
expect(plugin[:platform]).to eq("scientific")
|
405
406
|
end
|
406
407
|
|
407
|
-
it "
|
408
|
+
it "sets platform to ibm_powerkvm and platform_family to rhel when [:lsb][:id] contains IBM_PowerKVM" do
|
408
409
|
plugin[:lsb][:id] = "IBM_PowerKVM"
|
409
410
|
plugin[:lsb][:release] = "2.1"
|
410
411
|
plugin.run
|
@@ -417,24 +418,24 @@ describe Ohai::System, "Linux plugin platform" do
|
|
417
418
|
|
418
419
|
let(:have_debian_version) { true }
|
419
420
|
|
420
|
-
before
|
421
|
+
before do
|
421
422
|
plugin.lsb = nil
|
422
423
|
end
|
423
424
|
|
424
|
-
it "
|
425
|
+
it "reads the version from /etc/debian_version" do
|
425
426
|
expect(File).to receive(:read).with("/etc/debian_version").and_return("9.5")
|
426
427
|
plugin.run
|
427
428
|
expect(plugin[:platform_version]).to eq("9.5")
|
428
429
|
end
|
429
430
|
|
430
|
-
it "
|
431
|
+
it "correctlies strip any newlines" do
|
431
432
|
expect(File).to receive(:read).with("/etc/debian_version").and_return("9.5\n")
|
432
433
|
plugin.run
|
433
434
|
expect(plugin[:platform_version]).to eq("9.5")
|
434
435
|
end
|
435
436
|
|
436
437
|
# Ubuntu has /etc/debian_version as well
|
437
|
-
it "
|
438
|
+
it "detects Ubuntu as itself rather than debian" do
|
438
439
|
plugin[:lsb][:id] = "Ubuntu"
|
439
440
|
plugin[:lsb][:release] = "18.04"
|
440
441
|
plugin.run
|
@@ -446,18 +447,18 @@ describe Ohai::System, "Linux plugin platform" do
|
|
446
447
|
|
447
448
|
let(:have_slackware_version) { true }
|
448
449
|
|
449
|
-
before
|
450
|
+
before do
|
450
451
|
plugin.lsb = nil
|
451
452
|
end
|
452
453
|
|
453
|
-
it "
|
454
|
+
it "sets platform and platform_family to slackware" do
|
454
455
|
expect(File).to receive(:read).with("/etc/slackware-version").and_return("Slackware 12.0.0")
|
455
456
|
plugin.run
|
456
457
|
expect(plugin[:platform]).to eq("slackware")
|
457
458
|
expect(plugin[:platform_family]).to eq("slackware")
|
458
459
|
end
|
459
460
|
|
460
|
-
it "
|
461
|
+
it "sets platform_version on slackware" do
|
461
462
|
expect(File).to receive(:read).with("/etc/slackware-version").and_return("Slackware 12.0.0")
|
462
463
|
plugin.run
|
463
464
|
expect(plugin[:platform_version]).to eq("12.0.0")
|
@@ -470,11 +471,11 @@ describe Ohai::System, "Linux plugin platform" do
|
|
470
471
|
let(:have_redhat_release) { true }
|
471
472
|
let(:have_eos_release) { true }
|
472
473
|
|
473
|
-
before
|
474
|
+
before do
|
474
475
|
plugin.lsb = nil
|
475
476
|
end
|
476
477
|
|
477
|
-
it "
|
478
|
+
it "sets platform to arista_eos" do
|
478
479
|
expect(File).to receive(:read).with("/etc/Eos-release").and_return("Arista Networks EOS 4.21.1.1F")
|
479
480
|
plugin.run
|
480
481
|
expect(plugin[:platform]).to eq("arista_eos")
|
@@ -487,11 +488,11 @@ describe Ohai::System, "Linux plugin platform" do
|
|
487
488
|
|
488
489
|
let(:have_f5_release) { true }
|
489
490
|
|
490
|
-
before
|
491
|
+
before do
|
491
492
|
plugin.lsb = nil
|
492
493
|
end
|
493
494
|
|
494
|
-
it "
|
495
|
+
it "sets platform to bigip" do
|
495
496
|
expect(File).to receive(:read).with("/etc/f5-release").and_return("BIG-IP release 13.0.0 (Final)")
|
496
497
|
plugin.run
|
497
498
|
expect(plugin[:platform]).to eq("bigip")
|
@@ -504,18 +505,18 @@ describe Ohai::System, "Linux plugin platform" do
|
|
504
505
|
|
505
506
|
let(:have_exherbo_release) { true }
|
506
507
|
|
507
|
-
before
|
508
|
+
before do
|
508
509
|
allow(plugin).to receive(:shell_out).with("/bin/uname -r").and_return(mock_shell_out(0, "3.18.2-2-ARCH\n", ""))
|
509
510
|
plugin.lsb = nil
|
510
511
|
end
|
511
512
|
|
512
|
-
it "
|
513
|
+
it "sets platform and platform_family to exherbo" do
|
513
514
|
plugin.run
|
514
515
|
expect(plugin[:platform]).to eq("exherbo")
|
515
516
|
expect(plugin[:platform_family]).to eq("exherbo")
|
516
517
|
end
|
517
518
|
|
518
|
-
it "
|
519
|
+
it "sets platform_version to kernel release" do
|
519
520
|
plugin.run
|
520
521
|
expect(plugin[:platform_version]).to eq("3.18.2-2-ARCH")
|
521
522
|
end
|
@@ -524,7 +525,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
524
525
|
|
525
526
|
describe "on redhat breeds" do
|
526
527
|
describe "with lsb_release results" do
|
527
|
-
it "
|
528
|
+
it "sets the platform to redhat and platform_family to rhel even if the LSB name is something absurd but redhat like" do
|
528
529
|
plugin[:lsb][:id] = "RedHatEnterpriseServer"
|
529
530
|
plugin[:lsb][:release] = "7.5"
|
530
531
|
plugin.run
|
@@ -533,7 +534,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
533
534
|
expect(plugin[:platform_family]).to eq("rhel")
|
534
535
|
end
|
535
536
|
|
536
|
-
it "
|
537
|
+
it "sets the platform to centos and platform_family to rhel" do
|
537
538
|
plugin[:lsb][:id] = "CentOS"
|
538
539
|
plugin[:lsb][:release] = "7.5"
|
539
540
|
plugin.run
|
@@ -547,11 +548,11 @@ describe Ohai::System, "Linux plugin platform" do
|
|
547
548
|
|
548
549
|
let(:have_redhat_release) { true }
|
549
550
|
|
550
|
-
before
|
551
|
+
before do
|
551
552
|
plugin.lsb = nil
|
552
553
|
end
|
553
554
|
|
554
|
-
it "
|
555
|
+
it "reads the platform as centos and version as 7.5" do
|
555
556
|
expect(File).to receive(:read).with("/etc/redhat-release").and_return("CentOS Linux release 7.5.1804 (Core)")
|
556
557
|
plugin.run
|
557
558
|
expect(plugin[:platform]).to eq("centos")
|
@@ -564,7 +565,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
564
565
|
expect(plugin[:platform]).to eq("redhat")
|
565
566
|
end
|
566
567
|
|
567
|
-
it "
|
568
|
+
it "reads the platform as redhat without a space" do
|
568
569
|
expect(File).to receive(:read).with("/etc/redhat-release").and_return("RedHat release 5.3")
|
569
570
|
plugin.run
|
570
571
|
expect(plugin[:platform]).to eq("redhat")
|
@@ -581,7 +582,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
581
582
|
|
582
583
|
describe "with lsb_result" do
|
583
584
|
|
584
|
-
it "
|
585
|
+
it "reads the platform as parallels and version as 6.0.5" do
|
585
586
|
plugin[:lsb][:id] = "CloudLinuxServer"
|
586
587
|
plugin[:lsb][:release] = "6.5"
|
587
588
|
allow(File).to receive(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
|
@@ -595,11 +596,11 @@ describe Ohai::System, "Linux plugin platform" do
|
|
595
596
|
|
596
597
|
describe "without lsb_results" do
|
597
598
|
|
598
|
-
before
|
599
|
+
before do
|
599
600
|
plugin.lsb = nil
|
600
601
|
end
|
601
602
|
|
602
|
-
it "
|
603
|
+
it "reads the platform as parallels and version as 6.0.5" do
|
603
604
|
allow(File).to receive(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
|
604
605
|
expect(File).to receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
|
605
606
|
plugin.run
|
@@ -620,7 +621,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
620
621
|
|
621
622
|
let(:have_enterprise_release) { true }
|
622
623
|
|
623
|
-
it "
|
624
|
+
it "reads the platform as oracle and version as 5.7" do
|
624
625
|
plugin[:lsb][:id] = "EnterpriseEnterpriseServer"
|
625
626
|
plugin[:lsb][:release] = "5.7"
|
626
627
|
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
|
@@ -635,7 +636,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
635
636
|
|
636
637
|
let(:have_oracle_release) { true }
|
637
638
|
|
638
|
-
it "
|
639
|
+
it "reads the platform as oracle and version as 6.1" do
|
639
640
|
plugin[:lsb][:id] = "OracleServer"
|
640
641
|
plugin[:lsb][:release] = "6.1"
|
641
642
|
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
|
@@ -649,7 +650,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
649
650
|
end
|
650
651
|
|
651
652
|
context "without lsb_results" do
|
652
|
-
before
|
653
|
+
before do
|
653
654
|
plugin.lsb = nil
|
654
655
|
end
|
655
656
|
|
@@ -657,7 +658,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
657
658
|
|
658
659
|
let(:have_enterprise_release) { true }
|
659
660
|
|
660
|
-
it "
|
661
|
+
it "reads the platform as oracle and version as 5" do
|
661
662
|
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
|
662
663
|
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
|
663
664
|
plugin.run
|
@@ -665,7 +666,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
665
666
|
expect(plugin[:platform_version]).to eq("5")
|
666
667
|
end
|
667
668
|
|
668
|
-
it "
|
669
|
+
it "reads the platform as oracle and version as 5.1" do
|
669
670
|
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
|
670
671
|
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
|
671
672
|
plugin.run
|
@@ -673,7 +674,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
673
674
|
expect(plugin[:platform_version]).to eq("5.1")
|
674
675
|
end
|
675
676
|
|
676
|
-
it "
|
677
|
+
it "reads the platform as oracle and version as 5.7" do
|
677
678
|
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
|
678
679
|
expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
|
679
680
|
plugin.run
|
@@ -687,7 +688,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
687
688
|
|
688
689
|
let(:have_oracle_release) { true }
|
689
690
|
|
690
|
-
it "
|
691
|
+
it "reads the platform as oracle and version as 6.0" do
|
691
692
|
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.0 (Santiago)")
|
692
693
|
expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.0")
|
693
694
|
plugin.run
|
@@ -695,7 +696,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
695
696
|
expect(plugin[:platform_version]).to eq("6.0")
|
696
697
|
end
|
697
698
|
|
698
|
-
it "
|
699
|
+
it "reads the platform as oracle and version as 6.1" do
|
699
700
|
allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
|
700
701
|
expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
|
701
702
|
plugin.run
|
@@ -712,11 +713,11 @@ describe Ohai::System, "Linux plugin platform" do
|
|
712
713
|
let(:have_os_release) { false }
|
713
714
|
|
714
715
|
describe "with lsb_release results" do
|
715
|
-
before
|
716
|
+
before do
|
716
717
|
plugin[:lsb][:id] = "SUSE LINUX"
|
717
718
|
end
|
718
719
|
|
719
|
-
it "
|
720
|
+
it "reads the platform as opensuse on openSUSE" do
|
720
721
|
plugin[:lsb][:release] = "12.1"
|
721
722
|
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
|
722
723
|
plugin.run
|
@@ -730,18 +731,18 @@ describe Ohai::System, "Linux plugin platform" do
|
|
730
731
|
let(:have_suse_release) { true }
|
731
732
|
|
732
733
|
describe "without lsb_release results" do
|
733
|
-
before
|
734
|
+
before do
|
734
735
|
plugin.lsb = nil
|
735
736
|
end
|
736
737
|
|
737
|
-
it "
|
738
|
+
it "sets platform and platform_family to suse and bogus verion to 10.0" do
|
738
739
|
expect(File).to receive(:read).with("/etc/SuSE-release").at_least(:once).and_return("VERSION = 10.0")
|
739
740
|
plugin.run
|
740
741
|
expect(plugin[:platform]).to eq("suse")
|
741
742
|
expect(plugin[:platform_family]).to eq("suse")
|
742
743
|
end
|
743
744
|
|
744
|
-
it "
|
745
|
+
it "reads the version as 11.2" do
|
745
746
|
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 11.2 (i586)\nVERSION = 11\nPATCHLEVEL = 2\n")
|
746
747
|
plugin.run
|
747
748
|
expect(plugin[:platform]).to eq("suse")
|
@@ -765,14 +766,14 @@ describe Ohai::System, "Linux plugin platform" do
|
|
765
766
|
expect(plugin[:platform_family]).to eq("suse")
|
766
767
|
end
|
767
768
|
|
768
|
-
it "
|
769
|
+
it "reads the platform as opensuse on openSUSE" do
|
769
770
|
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.2 (x86_64)\nVERSION = 12.2\nCODENAME = Mantis\n")
|
770
771
|
plugin.run
|
771
772
|
expect(plugin[:platform]).to eq("opensuse")
|
772
773
|
expect(plugin[:platform_family]).to eq("suse")
|
773
774
|
end
|
774
775
|
|
775
|
-
it "
|
776
|
+
it "reads the platform as opensuseleap on openSUSE Leap" do
|
776
777
|
expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 42.1 (x86_64)\nVERSION = 42.1\nCODENAME = Malachite\n")
|
777
778
|
plugin.run
|
778
779
|
expect(plugin[:platform]).to eq("opensuseleap")
|
@@ -794,10 +795,12 @@ describe Ohai::System, "Linux plugin platform" do
|
|
794
795
|
PRETTY_NAME="Clear Linux OS"
|
795
796
|
CLEARLINUX_RELEASE
|
796
797
|
end
|
798
|
+
|
797
799
|
before do
|
798
800
|
expect(File).to receive(:read).with("/usr/lib/os-release").and_return(usr_lib_os_release_content)
|
799
801
|
end
|
800
|
-
|
802
|
+
|
803
|
+
it "sets platform to clearlinux and platform_family to clearlinux" do
|
801
804
|
plugin.lsb = nil
|
802
805
|
plugin.run
|
803
806
|
expect(plugin[:platform]).to eq("clearlinux")
|
@@ -21,11 +21,11 @@ require "spec_helper"
|
|
21
21
|
describe Ohai::System, "Linux sessions plugin" do
|
22
22
|
let(:plugin) { get_plugin("linux/sessions") }
|
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 sessions if loginctl is found" do
|
29
29
|
loginctl_out = <<-LOGINCTL_OUT
|
30
30
|
c1 118 Debian-gdm seat0
|
31
31
|
318 0 root
|
@@ -90,7 +90,7 @@ describe Ohai::System, "Linux sessions plugin" do
|
|
90
90
|
})
|
91
91
|
end
|
92
92
|
|
93
|
-
it "
|
93
|
+
it "does not populate sessions if loginctl is not found" do
|
94
94
|
allow(plugin).to receive(:which).with("loginctl").and_return(false)
|
95
95
|
plugin.run
|
96
96
|
expect(plugin[:sessions]).to be(nil)
|