ohai 14.2.0 → 14.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Rakefile +1 -1
  4. data/lib/ohai/application.rb +29 -29
  5. data/lib/ohai/common/dmi.rb +5 -5
  6. data/lib/ohai/dsl/plugin.rb +3 -3
  7. data/lib/ohai/dsl/plugin/versionvii.rb +3 -3
  8. data/lib/ohai/mixin/azure_metadata.rb +2 -2
  9. data/lib/ohai/mixin/do_metadata.rb +3 -3
  10. data/lib/ohai/mixin/ec2_metadata.rb +8 -8
  11. data/lib/ohai/mixin/gce_metadata.rb +2 -2
  12. data/lib/ohai/mixin/network_constants.rb +1 -1
  13. data/lib/ohai/mixin/scaleway_metadata.rb +3 -3
  14. data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
  15. data/lib/ohai/mixin/string.rb +2 -2
  16. data/lib/ohai/plugins/aix/cpu.rb +3 -3
  17. data/lib/ohai/plugins/aix/filesystem.rb +1 -1
  18. data/lib/ohai/plugins/aix/kernel.rb +1 -1
  19. data/lib/ohai/plugins/aix/memory.rb +1 -1
  20. data/lib/ohai/plugins/aix/network.rb +3 -3
  21. data/lib/ohai/plugins/bsd/virtualization.rb +1 -1
  22. data/lib/ohai/plugins/cloud.rb +1 -1
  23. data/lib/ohai/plugins/darwin/hardware.rb +1 -1
  24. data/lib/ohai/plugins/darwin/network.rb +5 -5
  25. data/lib/ohai/plugins/darwin/platform.rb +1 -1
  26. data/lib/ohai/plugins/dmi.rb +6 -6
  27. data/lib/ohai/plugins/filesystem.rb +5 -5
  28. data/lib/ohai/plugins/hostname.rb +5 -5
  29. data/lib/ohai/plugins/kernel.rb +8 -8
  30. data/lib/ohai/plugins/linux/lspci.rb +4 -4
  31. data/lib/ohai/plugins/linux/memory.rb +4 -4
  32. data/lib/ohai/plugins/linux/network.rb +16 -16
  33. data/lib/ohai/plugins/linux/platform.rb +7 -1
  34. data/lib/ohai/plugins/netbsd/network.rb +1 -1
  35. data/lib/ohai/plugins/network.rb +5 -5
  36. data/lib/ohai/plugins/openbsd/network.rb +1 -1
  37. data/lib/ohai/plugins/packages.rb +1 -1
  38. data/lib/ohai/plugins/passwd.rb +4 -4
  39. data/lib/ohai/plugins/ruby.rb +13 -13
  40. data/lib/ohai/plugins/solaris2/dmi.rb +3 -3
  41. data/lib/ohai/plugins/solaris2/filesystem.rb +6 -6
  42. data/lib/ohai/plugins/solaris2/memory.rb +2 -2
  43. data/lib/ohai/plugins/solaris2/network.rb +36 -36
  44. data/lib/ohai/plugins/windows/network.rb +2 -2
  45. data/lib/ohai/util/win32/group_helper.rb +1 -1
  46. data/lib/ohai/version.rb +1 -1
  47. data/spec/functional/application_spec.rb +6 -6
  48. data/spec/functional/loader_spec.rb +4 -4
  49. data/spec/functional/plugins/windows/uptime_spec.rb +1 -2
  50. data/spec/spec_helper.rb +5 -5
  51. data/spec/unit/application_spec.rb +11 -11
  52. data/spec/unit/config_spec.rb +5 -5
  53. data/spec/unit/dsl/plugin_spec.rb +5 -5
  54. data/spec/unit/hints_spec.rb +2 -2
  55. data/spec/unit/loader_spec.rb +41 -41
  56. data/spec/unit/mixin/azure_metadata_spec.rb +3 -3
  57. data/spec/unit/mixin/command_spec.rb +64 -64
  58. data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
  59. data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
  60. data/spec/unit/plugin_config_spec.rb +9 -9
  61. data/spec/unit/plugins/abort_spec.rb +6 -6
  62. data/spec/unit/plugins/aix/cpu_spec.rb +16 -16
  63. data/spec/unit/plugins/aix/filesystem_spec.rb +57 -57
  64. data/spec/unit/plugins/aix/network_spec.rb +35 -35
  65. data/spec/unit/plugins/aix/virtualization_spec.rb +210 -210
  66. data/spec/unit/plugins/azure_spec.rb +49 -49
  67. data/spec/unit/plugins/bsd/filesystem_spec.rb +13 -13
  68. data/spec/unit/plugins/bsd/virtualization_spec.rb +10 -10
  69. data/spec/unit/plugins/c_spec.rb +54 -54
  70. data/spec/unit/plugins/chef_spec.rb +3 -3
  71. data/spec/unit/plugins/darwin/cpu_spec.rb +54 -54
  72. data/spec/unit/plugins/darwin/filesystem_spec.rb +34 -34
  73. data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +1070 -1070
  74. data/spec/unit/plugins/darwin/memory_spec.rb +16 -16
  75. data/spec/unit/plugins/darwin/network_spec.rb +382 -382
  76. data/spec/unit/plugins/digital_ocean_spec.rb +7 -7
  77. data/spec/unit/plugins/dmi_spec.rb +83 -83
  78. data/spec/unit/plugins/docker_spec.rb +2 -2
  79. data/spec/unit/plugins/ec2_spec.rb +156 -156
  80. data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
  81. data/spec/unit/plugins/fail_spec.rb +14 -14
  82. data/spec/unit/plugins/freebsd/cpu_spec.rb +18 -18
  83. data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
  84. data/spec/unit/plugins/gce_spec.rb +1 -1
  85. data/spec/unit/plugins/init_package_spec.rb +1 -1
  86. data/spec/unit/plugins/java_spec.rb +4 -4
  87. data/spec/unit/plugins/joyent_spec.rb +9 -9
  88. data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
  89. data/spec/unit/plugins/linux/cpu_spec.rb +155 -155
  90. data/spec/unit/plugins/linux/filesystem_spec.rb +229 -229
  91. data/spec/unit/plugins/linux/kernel_spec.rb +9 -9
  92. data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
  93. data/spec/unit/plugins/linux/lspci_spec.rb +58 -58
  94. data/spec/unit/plugins/linux/mdadm_spec.rb +54 -54
  95. data/spec/unit/plugins/linux/memory_spec.rb +35 -35
  96. data/spec/unit/plugins/linux/network_spec.rb +464 -464
  97. data/spec/unit/plugins/linux/platform_spec.rb +84 -68
  98. data/spec/unit/plugins/linux/systemd_paths_spec.rb +40 -40
  99. data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
  100. data/spec/unit/plugins/linux/virtualization_spec.rb +197 -197
  101. data/spec/unit/plugins/mono_spec.rb +11 -11
  102. data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
  103. data/spec/unit/plugins/network_spec.rb +2 -2
  104. data/spec/unit/plugins/openstack_spec.rb +43 -43
  105. data/spec/unit/plugins/os_spec.rb +1 -1
  106. data/spec/unit/plugins/passwd_spec.rb +9 -9
  107. data/spec/unit/plugins/php_spec.rb +22 -22
  108. data/spec/unit/plugins/powershell_spec.rb +13 -13
  109. data/spec/unit/plugins/rackspace_spec.rb +38 -38
  110. data/spec/unit/plugins/ruby_spec.rb +14 -14
  111. data/spec/unit/plugins/scaleway_spec.rb +6 -6
  112. data/spec/unit/plugins/scsi_spec.rb +7 -7
  113. data/spec/unit/plugins/solaris2/cpu_spec.rb +2594 -2594
  114. data/spec/unit/plugins/solaris2/dmi_spec.rb +91 -91
  115. data/spec/unit/plugins/solaris2/filesystem.rb +8 -8
  116. data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
  117. data/spec/unit/plugins/solaris2/network_spec.rb +92 -93
  118. data/spec/unit/plugins/solaris2/platform_spec.rb +24 -24
  119. data/spec/unit/plugins/solaris2/virtualization_spec.rb +22 -22
  120. data/spec/unit/plugins/ssh_host_keys_spec.rb +12 -12
  121. data/spec/unit/plugins/sysconf_spec.rb +321 -321
  122. data/spec/unit/plugins/virtualbox_spec.rb +27 -27
  123. data/spec/unit/plugins/windows/cpu_spec.rb +9 -9
  124. data/spec/unit/plugins/windows/kernel_spec.rb +12 -12
  125. data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
  126. data/spec/unit/plugins/zpools_spec.rb +41 -41
  127. data/spec/unit/runner_spec.rb +2 -2
  128. data/spec/unit/system_spec.rb +55 -55
  129. metadata +3 -4
  130. data/docs/man/man1/ohai.1 +0 -97
@@ -181,16 +181,16 @@ describe Ohai::System, "Linux plugin platform" do
181
181
 
182
182
  let(:have_cumulus_dir) { true }
183
183
  let(:cumulus_release_content) do
184
- <<-OS_RELEASE
185
- NAME="Cumulus Linux"
186
- VERSION_ID=3.1.2
187
- VERSION="Cumulus Linux 3.1.2"
188
- PRETTY_NAME="Cumulus Linux"
189
- ID=cumulus-linux
190
- ID_LIKE=debian
191
- CPE_NAME=cpe:/o:cumulusnetworks:cumulus_linux:3.1.2
192
- HOME_URL="http://www.cumulusnetworks.com/"
193
- SUPPORT_URL="http://support.cumulusnetworks.com/"
184
+ <<~OS_RELEASE
185
+ NAME="Cumulus Linux"
186
+ VERSION_ID=3.1.2
187
+ VERSION="Cumulus Linux 3.1.2"
188
+ PRETTY_NAME="Cumulus Linux"
189
+ ID=cumulus-linux
190
+ ID_LIKE=debian
191
+ CPE_NAME=cpe:/o:cumulusnetworks:cumulus_linux:3.1.2
192
+ HOME_URL="http://www.cumulusnetworks.com/"
193
+ SUPPORT_URL="http://support.cumulusnetworks.com/"
194
194
 
195
195
  OS_RELEASE
196
196
  end
@@ -458,6 +458,22 @@ OS_RELEASE
458
458
  expect(@plugin[:platform_version].to_f).to eq(7.3)
459
459
  end
460
460
 
461
+ it "should read the platform as amazon and version as 2 on the RC release" do
462
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Amazon Linux release 2 (2017.12) LTS Release Candidate")
463
+ @plugin.run
464
+ expect(@plugin[:platform]).to eq("amazon")
465
+ expect(@plugin[:platform_family]).to eq("amazon")
466
+ expect(@plugin[:platform_version].to_f).to eq(2)
467
+ end
468
+
469
+ it "should read the platform as amazon and version as 2 on the final release" do
470
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Amazon Linux 2")
471
+ @plugin.run
472
+ expect(@plugin[:platform]).to eq("amazon")
473
+ expect(@plugin[:platform_family]).to eq("amazon")
474
+ expect(@plugin[:platform_version].to_f).to eq(2)
475
+ end
476
+
461
477
  # https://github.com/chef/ohai/issues/560
462
478
  # Issue is seen on EL7, so that's what we're testing.
463
479
  context "on versions that have /etc/os-release" do
@@ -465,17 +481,17 @@ OS_RELEASE
465
481
  let(:have_os_release) { true }
466
482
 
467
483
  let(:os_release_content) do
468
- <<-OS_RELEASE
469
- NAME="CentOS Linux"
470
- VERSION="7 (Core)"
471
- ID="centos"
472
- ID_LIKE="rhel fedora"
473
- VERSION_ID="7"
474
- PRETTY_NAME="CentOS Linux 7 (Core)"
475
- ANSI_COLOR="0;31"
476
- CPE_NAME="cpe:/o:centos:centos:7"
477
- HOME_URL="https://www.centos.org/"
478
- BUG_REPORT_URL="https://bugs.centos.org/"
484
+ <<~OS_RELEASE
485
+ NAME="CentOS Linux"
486
+ VERSION="7 (Core)"
487
+ ID="centos"
488
+ ID_LIKE="rhel fedora"
489
+ VERSION_ID="7"
490
+ PRETTY_NAME="CentOS Linux 7 (Core)"
491
+ ANSI_COLOR="0;31"
492
+ CPE_NAME="cpe:/o:centos:centos:7"
493
+ HOME_URL="https://www.centos.org/"
494
+ BUG_REPORT_URL="https://bugs.centos.org/"
479
495
 
480
496
  OS_RELEASE
481
497
  end
@@ -498,40 +514,40 @@ OS_RELEASE
498
514
  let(:have_os_release) { true }
499
515
 
500
516
  let(:os_release_content) do
501
- <<-OS_RELEASE
502
- NAME="CentOS Linux"
503
- VERSION="7 (Core)"
504
- ID="centos"
505
- ID_LIKE="rhel fedora"
506
- VERSION_ID="7"
507
- PRETTY_NAME="CentOS Linux 7 (Core)"
508
- ANSI_COLOR="0;31"
509
- CPE_NAME="cpe:/o:centos:centos:7"
510
- HOME_URL="https://www.centos.org/"
511
- BUG_REPORT_URL="https://bugs.centos.org/"
512
-
513
- CENTOS_MANTISBT_PROJECT="CentOS-7"
514
- CENTOS_MANTISBT_PROJECT_VERSION="7"
515
- REDHAT_SUPPORT_PRODUCT="centos"
516
- REDHAT_SUPPORT_PRODUCT_VERSION="7"
517
-
518
- CISCO_RELEASE_INFO=/etc/shared/os-release
517
+ <<~OS_RELEASE
518
+ NAME="CentOS Linux"
519
+ VERSION="7 (Core)"
520
+ ID="centos"
521
+ ID_LIKE="rhel fedora"
522
+ VERSION_ID="7"
523
+ PRETTY_NAME="CentOS Linux 7 (Core)"
524
+ ANSI_COLOR="0;31"
525
+ CPE_NAME="cpe:/o:centos:centos:7"
526
+ HOME_URL="https://www.centos.org/"
527
+ BUG_REPORT_URL="https://bugs.centos.org/"
528
+
529
+ CENTOS_MANTISBT_PROJECT="CentOS-7"
530
+ CENTOS_MANTISBT_PROJECT_VERSION="7"
531
+ REDHAT_SUPPORT_PRODUCT="centos"
532
+ REDHAT_SUPPORT_PRODUCT_VERSION="7"
533
+
534
+ CISCO_RELEASE_INFO=/etc/shared/os-release
519
535
  OS_RELEASE
520
536
  end
521
537
 
522
538
  let(:have_cisco_release) { true }
523
539
 
524
540
  let(:cisco_release_content) do
525
- <<-CISCO_RELEASE
526
- ID=nexus
527
- ID_LIKE=wrlinux
528
- NAME=Nexus
529
- VERSION="7.0(3)I2(0.475E.6)"
530
- VERSION_ID="7.0(3)I2"
531
- PRETTY_NAME="Nexus 7.0(3)I2"
532
- HOME_URL=http://www.cisco.com
533
- BUILD_ID=6
534
- CISCO_RELEASE_INFO=/etc/os-release
541
+ <<~CISCO_RELEASE
542
+ ID=nexus
543
+ ID_LIKE=wrlinux
544
+ NAME=Nexus
545
+ VERSION="7.0(3)I2(0.475E.6)"
546
+ VERSION_ID="7.0(3)I2"
547
+ PRETTY_NAME="Nexus 7.0(3)I2"
548
+ HOME_URL=http://www.cisco.com
549
+ BUILD_ID=6
550
+ CISCO_RELEASE_INFO=/etc/os-release
535
551
  CISCO_RELEASE
536
552
  end
537
553
 
@@ -692,14 +708,14 @@ CISCO_RELEASE
692
708
  let(:have_os_release) { true }
693
709
 
694
710
  let(:os_release_content) do
695
- <<-OS_RELEASE
696
- VERSION="15"
697
- VERSION_ID="15"
698
- PRETTY_NAME="SUSE Linux Enterprise Server 15"
699
- ID="sles"
700
- ID_LIKE="suse"
701
- ANSI_COLOR="0;32"
702
- CPE_NAME="cpe:/o:suse:sles:15"
711
+ <<~OS_RELEASE
712
+ VERSION="15"
713
+ VERSION_ID="15"
714
+ PRETTY_NAME="SUSE Linux Enterprise Server 15"
715
+ ID="sles"
716
+ ID_LIKE="suse"
717
+ ANSI_COLOR="0;32"
718
+ CPE_NAME="cpe:/o:suse:sles:15"
703
719
 
704
720
  OS_RELEASE
705
721
  end
@@ -945,17 +961,17 @@ OS_RELEASE
945
961
  describe "on clearlinux" do
946
962
  let(:have_usr_lib_os_release) { true }
947
963
  let(:usr_lib_os_release_content) do
948
- <<-CLEARLINUX_RELEASE
949
- NAME="Clear Linux Software for Intel Architecture"
950
- VERSION=1
951
- ID=clear-linux-os
952
- VERSION_ID=16140
953
- PRETTY_NAME="Clear Linux OS for Intel Architecture"
954
- ANSI_COLOR="1;35"
955
- HOME_URL="https://clearlinux.org"
956
- SUPPORT_URL="https://clearlinux.org"
957
- BUG_REPORT_URL="mailto:dev@lists.clearlinux.org"
958
- PRIVACY_POLICY_URL="http://www.intel.com/privacy"
964
+ <<~CLEARLINUX_RELEASE
965
+ NAME="Clear Linux Software for Intel Architecture"
966
+ VERSION=1
967
+ ID=clear-linux-os
968
+ VERSION_ID=16140
969
+ PRETTY_NAME="Clear Linux OS for Intel Architecture"
970
+ ANSI_COLOR="1;35"
971
+ HOME_URL="https://clearlinux.org"
972
+ SUPPORT_URL="https://clearlinux.org"
973
+ BUG_REPORT_URL="mailto:dev@lists.clearlinux.org"
974
+ PRIVACY_POLICY_URL="http://www.intel.com/privacy"
959
975
  CLEARLINUX_RELEASE
960
976
  end
961
977
 
@@ -26,46 +26,46 @@ describe Ohai::System, "Linux systemd paths plugin" do
26
26
  end
27
27
 
28
28
  it "should populate systemd_paths if systemd-path is found" do
29
- systemd_path_out = <<-SYSTEMD_PATH_OUT
30
- temporary: /tmp
31
- temporary-large: /var/tmp
32
- system-binaries: /usr/bin
33
- system-include: /usr/include
34
- system-library-private: /usr/lib
35
- system-library-arch: /usr/lib/x86_64-linux-gnu
36
- system-shared: /usr/share
37
- system-configuration-factory: /usr/share/factory/etc
38
- system-state-factory: /usr/share/factory/var
39
- system-configuration: /etc
40
- system-runtime: /run
41
- system-runtime-logs: /run/log
42
- system-state-private: /var/lib
43
- system-state-logs: /var/log
44
- system-state-cache: /var/cache
45
- system-state-spool: /var/spool
46
- user-binaries: /home/foo/.local/bin
47
- user-library-private: /home/foo/.local/lib
48
- user-library-arch: /home/foo/.local/lib/x86_64-linux-gnu
49
- user-shared: /home/foo/.local/share
50
- user-configuration: /home/foo/.config
51
- user-runtime: /run/user/1000
52
- user-state-cache: /home/foo/.cache
53
- user: /home/foo
54
- user-documents: /home/foo/Documents
55
- user-music: /home/foo/Music
56
- user-pictures: /home/foo/Pictures
57
- user-videos: /home/foo/Videos
58
- user-download: /home/foo/Downloads
59
- user-public: /home/foo/Public
60
- user-templates: /home/foo/Templates
61
- user-desktop: /home/foo/Desktop
62
- search-binaries: /home/foo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/facebook/bin:/home/foo/.rvm/bin:/home/foo/.rvm/bin
63
- search-library-private: /home/foo/.local/lib:/usr/local/lib:/usr/lib:/lib
64
- search-library-arch: /home/foo/.local/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu
65
- search-shared: /home/foo/.local/share:/usr/share/gnome:/home/foo/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
66
- search-configuration-factory: /usr/local/share/factory/etc:/usr/share/factory/etc
67
- search-state-factory: /usr/local/share/factory/var:/usr/share/factory/var
68
- search-configuration: /home/foo/.config:/etc
29
+ systemd_path_out = <<~SYSTEMD_PATH_OUT
30
+ temporary: /tmp
31
+ temporary-large: /var/tmp
32
+ system-binaries: /usr/bin
33
+ system-include: /usr/include
34
+ system-library-private: /usr/lib
35
+ system-library-arch: /usr/lib/x86_64-linux-gnu
36
+ system-shared: /usr/share
37
+ system-configuration-factory: /usr/share/factory/etc
38
+ system-state-factory: /usr/share/factory/var
39
+ system-configuration: /etc
40
+ system-runtime: /run
41
+ system-runtime-logs: /run/log
42
+ system-state-private: /var/lib
43
+ system-state-logs: /var/log
44
+ system-state-cache: /var/cache
45
+ system-state-spool: /var/spool
46
+ user-binaries: /home/foo/.local/bin
47
+ user-library-private: /home/foo/.local/lib
48
+ user-library-arch: /home/foo/.local/lib/x86_64-linux-gnu
49
+ user-shared: /home/foo/.local/share
50
+ user-configuration: /home/foo/.config
51
+ user-runtime: /run/user/1000
52
+ user-state-cache: /home/foo/.cache
53
+ user: /home/foo
54
+ user-documents: /home/foo/Documents
55
+ user-music: /home/foo/Music
56
+ user-pictures: /home/foo/Pictures
57
+ user-videos: /home/foo/Videos
58
+ user-download: /home/foo/Downloads
59
+ user-public: /home/foo/Public
60
+ user-templates: /home/foo/Templates
61
+ user-desktop: /home/foo/Desktop
62
+ search-binaries: /home/foo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/facebook/bin:/home/foo/.rvm/bin:/home/foo/.rvm/bin
63
+ search-library-private: /home/foo/.local/lib:/usr/local/lib:/usr/lib:/lib
64
+ search-library-arch: /home/foo/.local/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu
65
+ search-shared: /home/foo/.local/share:/usr/share/gnome:/home/foo/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
66
+ search-configuration-factory: /usr/local/share/factory/etc:/usr/share/factory/etc
67
+ search-state-factory: /usr/local/share/factory/var:/usr/share/factory/var
68
+ search-configuration: /home/foo/.config:/etc
69
69
  SYSTEMD_PATH_OUT
70
70
 
71
71
  allow(plugin).to receive(:which).with("systemd-path").and_return("/bin/systemd-path")
@@ -22,7 +22,7 @@ describe Ohai::System, "Linux plugin uptime" do
22
22
  before(:each) do
23
23
  @plugin = get_plugin("uptime")
24
24
  allow(@plugin).to receive(:collect_os).and_return(:linux)
25
- @double_file = double("/proc/uptime", { :gets => "18423 989" })
25
+ @double_file = double("/proc/uptime", { gets: "18423 989" })
26
26
  allow(File).to receive(:open).with("/proc/uptime").and_return(@double_file)
27
27
  end
28
28
 
@@ -192,14 +192,14 @@ describe Ohai::System, "Linux virtualization platform" do
192
192
  end
193
193
 
194
194
  it "sets virtualpc guest if dmidecode detects Microsoft Virtual Machine" do
195
- ms_vpc_dmidecode = <<-MSVPC
196
- System Information
197
- Manufacturer: Microsoft Corporation
198
- Product Name: Virtual Machine
199
- Version: VS2005R2
200
- Serial Number: 1688-7189-5337-7903-2297-1012-52
201
- UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
202
- Wake-up Type: Power Switch
195
+ ms_vpc_dmidecode = <<~MSVPC
196
+ System Information
197
+ Manufacturer: Microsoft Corporation
198
+ Product Name: Virtual Machine
199
+ Version: VS2005R2
200
+ Serial Number: 1688-7189-5337-7903-2297-1012-52
201
+ UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
202
+ Wake-up Type: Power Switch
203
203
  MSVPC
204
204
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, ms_vpc_dmidecode, ""))
205
205
  plugin.run
@@ -209,14 +209,14 @@ MSVPC
209
209
  end
210
210
 
211
211
  it "sets hyperv guest if dmidecode detects Hyper-V or version 7.0" do
212
- ms_hv_dmidecode = <<-MSHV
213
- System Information
214
- Manufacturer: Microsoft Corporation
215
- Product Name: Virtual Machine
216
- Version: 7.0
217
- Serial Number: 9242-2608-7031-8934-2088-5216-61
218
- UUID: C2431A2D-D69C-244F-9DE8-CD5D09E0DA39
219
- Wake-up Type: Power Switch
212
+ ms_hv_dmidecode = <<~MSHV
213
+ System Information
214
+ Manufacturer: Microsoft Corporation
215
+ Product Name: Virtual Machine
216
+ Version: 7.0
217
+ Serial Number: 9242-2608-7031-8934-2088-5216-61
218
+ UUID: C2431A2D-D69C-244F-9DE8-CD5D09E0DA39
219
+ Wake-up Type: Power Switch
220
220
  MSHV
221
221
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, ms_hv_dmidecode, ""))
222
222
  plugin.run
@@ -226,14 +226,14 @@ MSHV
226
226
  end
227
227
 
228
228
  it "sets virtualserver guest if dmidecode detects version 5.0" do
229
- ms_vs_dmidecode = <<-MSVS
230
- System Information
231
- Manufacturer: Microsoft Corporation
232
- Product Name: Virtual Machine
233
- Version: 5.0
234
- Serial Number: 1688-7189-5337-7903-2297-1012-52
235
- UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
236
- Wake-up Type: Power Switch
229
+ ms_vs_dmidecode = <<~MSVS
230
+ System Information
231
+ Manufacturer: Microsoft Corporation
232
+ Product Name: Virtual Machine
233
+ Version: 5.0
234
+ Serial Number: 1688-7189-5337-7903-2297-1012-52
235
+ UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
236
+ Wake-up Type: Power Switch
237
237
  MSVS
238
238
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, ms_vs_dmidecode, ""))
239
239
  plugin.run
@@ -243,16 +243,16 @@ MSVS
243
243
  end
244
244
 
245
245
  it "sets vmware guest if dmidecode detects VMware" do
246
- vmware_dmidecode = <<-VMWARE
247
- System Information
248
- Manufacturer: VMware, Inc.
249
- Product Name: VMware Virtual Platform
250
- Version: None
251
- Serial Number: VMware-50 3f f7 14 42 d1 f1 da-3b 46 27 d0 29 b4 74 1d
252
- UUID: a86cc405-e1b9-447b-ad05-6f8db39d876a
253
- Wake-up Type: Power Switch
254
- SKU Number: Not Specified
255
- Family: Not Specified
246
+ vmware_dmidecode = <<~VMWARE
247
+ System Information
248
+ Manufacturer: VMware, Inc.
249
+ Product Name: VMware Virtual Platform
250
+ Version: None
251
+ Serial Number: VMware-50 3f f7 14 42 d1 f1 da-3b 46 27 d0 29 b4 74 1d
252
+ UUID: a86cc405-e1b9-447b-ad05-6f8db39d876a
253
+ Wake-up Type: Power Switch
254
+ SKU Number: Not Specified
255
+ Family: Not Specified
256
256
  VMWARE
257
257
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, vmware_dmidecode, ""))
258
258
  plugin.run
@@ -262,18 +262,18 @@ VMWARE
262
262
  end
263
263
 
264
264
  it "sets vbox guest if dmidecode detects VirtualBox" do
265
- vbox_dmidecode = <<-VBOX
266
- Base Board Information
267
- Manufacturer: Oracle Corporation
268
- Product Name: VirtualBox
269
- Version: 1.2
270
- Serial Number: 0
271
- Asset Tag: Not Specified
272
- Features:
273
- Board is a hosting board
274
- Location In Chasis: Not Specified
275
- Type: Motherboard
276
- Contained Object Handles: 0
265
+ vbox_dmidecode = <<~VBOX
266
+ Base Board Information
267
+ Manufacturer: Oracle Corporation
268
+ Product Name: VirtualBox
269
+ Version: 1.2
270
+ Serial Number: 0
271
+ Asset Tag: Not Specified
272
+ Features:
273
+ Board is a hosting board
274
+ Location In Chasis: Not Specified
275
+ Type: Motherboard
276
+ Contained Object Handles: 0
277
277
  VBOX
278
278
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, vbox_dmidecode, ""))
279
279
  plugin.run
@@ -283,16 +283,16 @@ VBOX
283
283
  end
284
284
 
285
285
  it "sets openstack guest if dmidecode detects OpenStack" do
286
- openstack_dmidecode = <<-OPENSTACK
287
- System Information
288
- Manufacturer: Red Hat Inc.
289
- Product Name: OpenStack Nova
290
- Version: 2014.1.2-1.el6
291
- Serial Number: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
292
- UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
293
- Wake-up Type: Power Switch
294
- SKU Number: Not Specified
295
- Family: Red Hat Enterprise Linux
286
+ openstack_dmidecode = <<~OPENSTACK
287
+ System Information
288
+ Manufacturer: Red Hat Inc.
289
+ Product Name: OpenStack Nova
290
+ Version: 2014.1.2-1.el6
291
+ Serial Number: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
292
+ UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
293
+ Wake-up Type: Power Switch
294
+ SKU Number: Not Specified
295
+ Family: Red Hat Enterprise Linux
296
296
  OPENSTACK
297
297
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, openstack_dmidecode, ""))
298
298
  plugin.run
@@ -302,16 +302,16 @@ OPENSTACK
302
302
  end
303
303
 
304
304
  it "sets kvm guest if dmidecode contains KVM" do
305
- kvm_dmidecode = <<-RKVM
306
- System Information
307
- Manufacturer: Red Hat
308
- Product Name: KVM
309
- Version: RHEL 7.0.0 PC (i440FX + PIIX, 1996)
310
- Serial Number: Not Specified
311
- UUID: 6E56CFE2-2088-4A46-906A-FC49EDC4072C
312
- Wake-up Type: Power Switch
313
- SKU Number: Not Specified
314
- Family: Red Hat Enterprise Linux
305
+ kvm_dmidecode = <<~RKVM
306
+ System Information
307
+ Manufacturer: Red Hat
308
+ Product Name: KVM
309
+ Version: RHEL 7.0.0 PC (i440FX + PIIX, 1996)
310
+ Serial Number: Not Specified
311
+ UUID: 6E56CFE2-2088-4A46-906A-FC49EDC4072C
312
+ Wake-up Type: Power Switch
313
+ SKU Number: Not Specified
314
+ Family: Red Hat Enterprise Linux
315
315
  RKVM
316
316
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, kvm_dmidecode, ""))
317
317
  plugin.run
@@ -321,16 +321,16 @@ RKVM
321
321
  end
322
322
 
323
323
  it "sets kvm guest if dmidecode detects RHEV" do
324
- kvm_dmidecode = <<-RHEV
325
- System Information
326
- Manufacturer: Red Hat
327
- Product Name: RHEV Hypervisor
328
- Version: 6.7-20150911.0.el6ev
329
- Serial Number: 00000000-0000-0000-0000-000000000000
330
- UUID: E7F1DC93-3DA1-4EC3-A6AB-F6904BA87985
331
- Wake-up Type: Power Switch
332
- SKU Number: Not Specified
333
- Family: Red Hat Enterprise Linux
324
+ kvm_dmidecode = <<~RHEV
325
+ System Information
326
+ Manufacturer: Red Hat
327
+ Product Name: RHEV Hypervisor
328
+ Version: 6.7-20150911.0.el6ev
329
+ Serial Number: 00000000-0000-0000-0000-000000000000
330
+ UUID: E7F1DC93-3DA1-4EC3-A6AB-F6904BA87985
331
+ Wake-up Type: Power Switch
332
+ SKU Number: Not Specified
333
+ Family: Red Hat Enterprise Linux
334
334
  RHEV
335
335
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, kvm_dmidecode, ""))
336
336
  plugin.run
@@ -340,16 +340,16 @@ RHEV
340
340
  end
341
341
 
342
342
  it "sets bhyve guest if dmidecode detects bhyve" do
343
- bhyve_dmidecode = <<-OUTPUT
344
- System Information
345
- Manufacturer:
346
- Product Name: BHYVE
347
- Version: 1.0
348
- Serial Number: None
349
- UUID: 023B323A-E139-4B36-8BC5-CEBB2469DAAA
350
- Wake-up Type: Power Switch
351
- SKU Number: None
352
- Family:
343
+ bhyve_dmidecode = <<~OUTPUT
344
+ System Information
345
+ Manufacturer:
346
+ Product Name: BHYVE
347
+ Version: 1.0
348
+ Serial Number: None
349
+ UUID: 023B323A-E139-4B36-8BC5-CEBB2469DAAA
350
+ Wake-up Type: Power Switch
351
+ SKU Number: None
352
+ Family:
353
353
  OUTPUT
354
354
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, bhyve_dmidecode, ""))
355
355
  plugin.run
@@ -359,16 +359,16 @@ OUTPUT
359
359
  end
360
360
 
361
361
  it "sets veertu guest if dmidecode detects Veertu" do
362
- veertu_dmidecode = <<-VEERTU
363
- System Information
364
- Manufacturer: Veertu
365
- Product Name: Veertu
366
- Version: Not Specified
367
- Serial Number: Not Specified
368
- UUID: Not Settable
369
- Wake-up Type: Power Switch
370
- SKU Number: Not Specified
371
- Family: Not Specified
362
+ veertu_dmidecode = <<~VEERTU
363
+ System Information
364
+ Manufacturer: Veertu
365
+ Product Name: Veertu
366
+ Version: Not Specified
367
+ Serial Number: Not Specified
368
+ UUID: Not Settable
369
+ Wake-up Type: Power Switch
370
+ SKU Number: Not Specified
371
+ Family: Not Specified
372
372
  VEERTU
373
373
  allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, veertu_dmidecode, ""))
374
374
  plugin.run
@@ -474,9 +474,9 @@ VEERTU
474
474
 
475
475
  describe "when we are checking for parallels" do
476
476
  it "sets parallels guest if /proc/bus/pci/devices contains 1ab84000" do
477
- devices = <<-DEVICES
478
- 0018 1ab84000 1f 8001 0 0 0 0 0 0 20 0 0 0 0 0 0 prl_tg
479
- 0028 1af41000 17 8201 ee000000 0 0 0 0 0 40 1000 0 0 0 0 0 virtio-pci
477
+ devices = <<~DEVICES
478
+ 0018 1ab84000 1f 8001 0 0 0 0 0 0 20 0 0 0 0 0 0 prl_tg
479
+ 0028 1af41000 17 8201 ee000000 0 0 0 0 0 40 1000 0 0 0 0 0 virtio-pci
480
480
  DEVICES
481
481
  expect(File).to receive(:exist?).with("/proc/bus/pci/devices").and_return(true)
482
482
  allow(File).to receive(:read).with("/proc/bus/pci/devices").and_return(devices)
@@ -487,9 +487,9 @@ VEERTU
487
487
  end
488
488
 
489
489
  it "does not set virtualization if /proc/bus/pci/devices not contains 1ab84000" do
490
- devices = <<-DEVICES
491
- 0030 1af41000 a 8401 ee040000 0 0 0 0 0 40 1000 0 0 0 0 0 virtio-pci
492
- 0050 10110022 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
490
+ devices = <<~DEVICES
491
+ 0030 1af41000 a 8401 ee040000 0 0 0 0 0 40 1000 0 0 0 0 0 virtio-pci
492
+ 0050 10110022 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
493
493
  DEVICES
494
494
  expect(File).to receive(:exist?).with("/proc/bus/pci/devices").and_return(true)
495
495
  allow(File).to receive(:read).with("/proc/bus/pci/devices").and_return(devices)
@@ -526,15 +526,15 @@ VEERTU
526
526
 
527
527
  describe "when we are checking for lxc" do
528
528
  it "sets lxc guest if /proc/self/cgroup exist and there are /lxc/<hexadecimal> mounts" do
529
- self_cgroup = <<-CGROUP
530
- 8:blkio:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
531
- 7:net_cls:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
532
- 6:freezer:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
533
- 5:devices:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
534
- 4:memory:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
535
- 3:cpuacct:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
536
- 2:cpu:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
537
- 1:cpuset:/
529
+ self_cgroup = <<~CGROUP
530
+ 8:blkio:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
531
+ 7:net_cls:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
532
+ 6:freezer:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
533
+ 5:devices:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
534
+ 4:memory:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
535
+ 3:cpuacct:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
536
+ 2:cpu:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
537
+ 1:cpuset:/
538
538
  CGROUP
539
539
  expect(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
540
540
  allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
@@ -545,15 +545,15 @@ CGROUP
545
545
  end
546
546
 
547
547
  it "sets lxc guest if /proc/self/cgroup exist and there are /lxc/<name> mounts" do
548
- self_cgroup = <<-CGROUP
549
- 8:blkio:/lxc/vanilla
550
- 7:net_cls:/lxc/vanilla
551
- 6:freezer:/lxc/vanilla
552
- 5:devices:/lxc/vanilla
553
- 4:memory:/lxc/vanilla
554
- 3:cpuacct:/lxc/vanilla
555
- 2:cpu:/lxc/vanilla
556
- 1:cpuset:/lxc/vanilla
548
+ self_cgroup = <<~CGROUP
549
+ 8:blkio:/lxc/vanilla
550
+ 7:net_cls:/lxc/vanilla
551
+ 6:freezer:/lxc/vanilla
552
+ 5:devices:/lxc/vanilla
553
+ 4:memory:/lxc/vanilla
554
+ 3:cpuacct:/lxc/vanilla
555
+ 2:cpu:/lxc/vanilla
556
+ 1:cpuset:/lxc/vanilla
557
557
  CGROUP
558
558
  expect(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
559
559
  allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
@@ -564,15 +564,15 @@ CGROUP
564
564
  end
565
565
 
566
566
  it "sets not set anything if /proc/self/cgroup exist and the cgroup is named arbitrarily, it isn't necessarily lxc." do
567
- self_cgroup = <<-CGROUP
568
- 8:blkio:/Charlie
569
- 7:net_cls:/Charlie
570
- 6:freezer:/Charlie
571
- 5:devices:/Charlie
572
- 4:memory:/Charlie
573
- 3:cpuacct:/Charlie
574
- 2:cpu:/Charlie
575
- 1:cpuset:/Charlie
567
+ self_cgroup = <<~CGROUP
568
+ 8:blkio:/Charlie
569
+ 7:net_cls:/Charlie
570
+ 6:freezer:/Charlie
571
+ 5:devices:/Charlie
572
+ 4:memory:/Charlie
573
+ 3:cpuacct:/Charlie
574
+ 2:cpu:/Charlie
575
+ 1:cpuset:/Charlie
576
576
  CGROUP
577
577
  allow(File).to receive(:read).with("/proc/1/environ").and_return("")
578
578
  expect(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
@@ -583,15 +583,15 @@ CGROUP
583
583
 
584
584
  context "/proc/self/cgroup only has / mounts" do
585
585
  before(:each) do
586
- self_cgroup = <<-CGROUP
587
- 8:blkio:/
588
- 7:net_cls:/
589
- 6:freezer:/
590
- 5:devices:/
591
- 4:memory:/
592
- 3:cpuacct:/
593
- 2:cpu:/
594
- 1:cpuset:/
586
+ self_cgroup = <<~CGROUP
587
+ 8:blkio:/
588
+ 7:net_cls:/
589
+ 6:freezer:/
590
+ 5:devices:/
591
+ 4:memory:/
592
+ 3:cpuacct:/
593
+ 2:cpu:/
594
+ 1:cpuset:/
595
595
  CGROUP
596
596
  expect(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
597
597
  allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
@@ -662,15 +662,15 @@ CGROUP
662
662
 
663
663
  describe "when we are checking for docker" do
664
664
  it "sets docker guest if /proc/self/cgroup exist and there are /docker/<hexadecimal> mounts" do
665
- self_cgroup = <<-CGROUP
666
- 8:blkio:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
667
- 7:net_cls:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
668
- 6:freezer:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
669
- 5:devices:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
670
- 4:memory:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
671
- 3:cpuacct:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
672
- 2:cpu:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
673
- 1:cpuset:/
665
+ self_cgroup = <<~CGROUP
666
+ 8:blkio:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
667
+ 7:net_cls:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
668
+ 6:freezer:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
669
+ 5:devices:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
670
+ 4:memory:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
671
+ 3:cpuacct:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
672
+ 2:cpu:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
673
+ 1:cpuset:/
674
674
  CGROUP
675
675
  allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
676
676
  allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
@@ -681,15 +681,15 @@ CGROUP
681
681
  end
682
682
 
683
683
  it "sets docker guest if /proc/self/cgroup exist and there are /docker/<name> mounts" do
684
- self_cgroup = <<-CGROUP
685
- 8:blkio:/docker/vanilla
686
- 7:net_cls:/docker/vanilla
687
- 6:freezer:/docker/vanilla
688
- 5:devices:/docker/vanilla
689
- 4:memory:/docker/vanilla
690
- 3:cpuacct:/docker/vanilla
691
- 2:cpu:/docker/vanilla
692
- 1:cpuset:/docker/vanilla
684
+ self_cgroup = <<~CGROUP
685
+ 8:blkio:/docker/vanilla
686
+ 7:net_cls:/docker/vanilla
687
+ 6:freezer:/docker/vanilla
688
+ 5:devices:/docker/vanilla
689
+ 4:memory:/docker/vanilla
690
+ 3:cpuacct:/docker/vanilla
691
+ 2:cpu:/docker/vanilla
692
+ 1:cpuset:/docker/vanilla
693
693
  CGROUP
694
694
  allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
695
695
  allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
@@ -700,20 +700,20 @@ CGROUP
700
700
  end
701
701
 
702
702
  it "sets docker guest if /proc/self/cgroup exist and there are /docker/docker-ce/<hexadecimal> mounts" do
703
- self_cgroup = <<-CGROUP
704
- 13:name=systemd:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
705
- 12:pids:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
706
- 11:hugetlb:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
707
- 10:net_prio:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
708
- 9:perf_event:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
709
- 8:net_cls:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
710
- 7:freezer:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
711
- 6:devices:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
712
- 5:memory:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
713
- 4:blkio:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
714
- 3:cpuacct:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
715
- 2:cpu:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
716
- 1:cpuset:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
703
+ self_cgroup = <<~CGROUP
704
+ 13:name=systemd:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
705
+ 12:pids:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
706
+ 11:hugetlb:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
707
+ 10:net_prio:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
708
+ 9:perf_event:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
709
+ 8:net_cls:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
710
+ 7:freezer:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
711
+ 6:devices:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
712
+ 5:memory:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
713
+ 4:blkio:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
714
+ 3:cpuacct:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
715
+ 2:cpu:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
716
+ 1:cpuset:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
717
717
  CGROUP
718
718
  allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
719
719
  allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
@@ -726,15 +726,15 @@ CGROUP
726
726
  # Relevant at least starting docker 1.6.2, kernel 4.0.5 & systemd 224-1.
727
727
  # Doi not exactly know which software/version really matters here.
728
728
  it "should set docker guest if /proc/self/cgroup exists and there are /system.slice/docker-<hexadecimal> mounts (systemd managed cgroup)" do
729
- self_cgroup = <<-CGROUP
730
- 8:devices:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
731
- 7:cpuset:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
732
- 6:blkio:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
733
- 5:freezer:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
734
- 4:net_cls:/
735
- 3:memory:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
736
- 2:cpu,cpuacct:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
737
- 1:name=systemd:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
729
+ self_cgroup = <<~CGROUP
730
+ 8:devices:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
731
+ 7:cpuset:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
732
+ 6:blkio:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
733
+ 5:freezer:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
734
+ 4:net_cls:/
735
+ 3:memory:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
736
+ 2:cpu,cpuacct:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
737
+ 1:name=systemd:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
738
738
  CGROUP
739
739
  allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
740
740
  allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
@@ -745,15 +745,15 @@ CGROUP
745
745
  end
746
746
 
747
747
  it "sets not set anything if /proc/self/cgroup exist and the cgroup is named arbitrarily, it isn't necessarily lxc." do
748
- self_cgroup = <<-CGROUP
749
- 8:blkio:/Charlie
750
- 7:net_cls:/Charlie
751
- 6:freezer:/Charlie
752
- 5:devices:/Charlie
753
- 4:memory:/Charlie
754
- 3:cpuacct:/Charlie
755
- 2:cpu:/Charlie
756
- 1:cpuset:/Charlie
748
+ self_cgroup = <<~CGROUP
749
+ 8:blkio:/Charlie
750
+ 7:net_cls:/Charlie
751
+ 6:freezer:/Charlie
752
+ 5:devices:/Charlie
753
+ 4:memory:/Charlie
754
+ 3:cpuacct:/Charlie
755
+ 2:cpu:/Charlie
756
+ 1:cpuset:/Charlie
757
757
  CGROUP
758
758
  allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
759
759
  allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
@@ -764,15 +764,15 @@ CGROUP
764
764
 
765
765
  context "/proc/self/cgroup only has / mounts" do
766
766
  before(:each) do
767
- self_cgroup = <<-CGROUP
768
- 8:blkio:/
769
- 7:net_cls:/
770
- 6:freezer:/
771
- 5:devices:/
772
- 4:memory:/
773
- 3:cpuacct:/
774
- 2:cpu:/
775
- 1:cpuset:/
767
+ self_cgroup = <<~CGROUP
768
+ 8:blkio:/
769
+ 7:net_cls:/
770
+ 6:freezer:/
771
+ 5:devices:/
772
+ 4:memory:/
773
+ 3:cpuacct:/
774
+ 2:cpu:/
775
+ 1:cpuset:/
776
776
  CGROUP
777
777
  allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
778
778
  allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)