ohai 16.6.5 → 16.10.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -11
  3. data/bin/ohai +1 -0
  4. data/lib/ohai.rb +1 -0
  5. data/lib/ohai/application.rb +1 -0
  6. data/lib/ohai/common/dmi.rb +1 -0
  7. data/lib/ohai/config.rb +1 -0
  8. data/lib/ohai/dsl.rb +1 -0
  9. data/lib/ohai/dsl/plugin.rb +2 -1
  10. data/lib/ohai/dsl/plugin/versionvii.rb +1 -2
  11. data/lib/ohai/exception.rb +1 -0
  12. data/lib/ohai/hints.rb +1 -0
  13. data/lib/ohai/log.rb +1 -0
  14. data/lib/ohai/mash.rb +1 -0
  15. data/lib/ohai/mixin/azure_metadata.rb +4 -3
  16. data/lib/ohai/mixin/chef_utils_wiring.rb +1 -0
  17. data/lib/ohai/mixin/command.rb +1 -0
  18. data/lib/ohai/mixin/constant_helper.rb +1 -0
  19. data/lib/ohai/mixin/dmi_decode.rb +1 -0
  20. data/lib/ohai/mixin/do_metadata.rb +3 -2
  21. data/lib/ohai/mixin/ec2_metadata.rb +37 -11
  22. data/lib/ohai/mixin/gce_metadata.rb +4 -3
  23. data/lib/ohai/mixin/http_helper.rb +1 -0
  24. data/lib/ohai/mixin/network_helper.rb +1 -0
  25. data/lib/ohai/mixin/os.rb +1 -0
  26. data/lib/ohai/mixin/scaleway_metadata.rb +3 -2
  27. data/lib/ohai/mixin/seconds_to_human.rb +1 -0
  28. data/lib/ohai/mixin/shell_out.rb +1 -0
  29. data/lib/ohai/mixin/softlayer_metadata.rb +2 -1
  30. data/lib/ohai/mixin/string.rb +1 -0
  31. data/lib/ohai/mixin/train_helpers.rb +1 -0
  32. data/lib/ohai/mixin/which.rb +1 -0
  33. data/lib/ohai/plugin_config.rb +1 -0
  34. data/lib/ohai/plugins/aix/kernel.rb +7 -4
  35. data/lib/ohai/plugins/aix/memory.rb +4 -3
  36. data/lib/ohai/plugins/aix/network.rb +51 -58
  37. data/lib/ohai/plugins/aix/platform.rb +3 -2
  38. data/lib/ohai/plugins/aix/uptime.rb +3 -2
  39. data/lib/ohai/plugins/aix/virtualization.rb +6 -6
  40. data/lib/ohai/plugins/azure.rb +1 -0
  41. data/lib/ohai/plugins/bsd/virtualization.rb +2 -1
  42. data/lib/ohai/plugins/c.rb +4 -3
  43. data/lib/ohai/plugins/chef.rb +1 -0
  44. data/lib/ohai/plugins/cloud.rb +2 -1
  45. data/lib/ohai/plugins/command.rb +1 -0
  46. data/lib/ohai/plugins/cpu.rb +27 -28
  47. data/lib/ohai/plugins/darwin/hardware.rb +1 -0
  48. data/lib/ohai/plugins/darwin/memory.rb +2 -3
  49. data/lib/ohai/plugins/darwin/network.rb +8 -9
  50. data/lib/ohai/plugins/darwin/platform.rb +1 -0
  51. data/lib/ohai/plugins/darwin/virtualization.rb +1 -0
  52. data/lib/ohai/plugins/digital_ocean.rb +3 -1
  53. data/lib/ohai/plugins/dmi.rb +5 -4
  54. data/lib/ohai/plugins/docker.rb +2 -1
  55. data/lib/ohai/plugins/dragonflybsd/memory.rb +9 -8
  56. data/lib/ohai/plugins/dragonflybsd/network.rb +1 -0
  57. data/lib/ohai/plugins/dragonflybsd/platform.rb +3 -2
  58. data/lib/ohai/plugins/ec2.rb +4 -0
  59. data/lib/ohai/plugins/elixir.rb +1 -1
  60. data/lib/ohai/plugins/erlang.rb +1 -0
  61. data/lib/ohai/plugins/eucalyptus.rb +4 -1
  62. data/lib/ohai/plugins/filesystem.rb +1 -1
  63. data/lib/ohai/plugins/fips.rb +1 -0
  64. data/lib/ohai/plugins/freebsd/memory.rb +9 -8
  65. data/lib/ohai/plugins/freebsd/network.rb +1 -0
  66. data/lib/ohai/plugins/freebsd/platform.rb +3 -2
  67. data/lib/ohai/plugins/gce.rb +1 -0
  68. data/lib/ohai/plugins/go.rb +1 -1
  69. data/lib/ohai/plugins/groovy.rb +1 -1
  70. data/lib/ohai/plugins/grub2.rb +40 -0
  71. data/lib/ohai/plugins/haskell.rb +1 -0
  72. data/lib/ohai/plugins/hostname.rb +2 -2
  73. data/lib/ohai/plugins/init_package.rb +1 -0
  74. data/lib/ohai/plugins/java.rb +1 -0
  75. data/lib/ohai/plugins/kernel.rb +7 -8
  76. data/lib/ohai/plugins/keys.rb +1 -0
  77. data/lib/ohai/plugins/languages.rb +1 -0
  78. data/lib/ohai/plugins/libvirt.rb +4 -3
  79. data/lib/ohai/plugins/linode.rb +22 -14
  80. data/lib/ohai/plugins/linux/block_device.rb +1 -0
  81. data/lib/ohai/plugins/linux/hostnamectl.rb +3 -2
  82. data/lib/ohai/plugins/linux/interrupts.rb +1 -0
  83. data/lib/ohai/plugins/linux/ipc.rb +1 -0
  84. data/lib/ohai/plugins/linux/lsb.rb +6 -19
  85. data/lib/ohai/plugins/linux/lspci.rb +1 -1
  86. data/lib/ohai/plugins/linux/machineid.rb +1 -0
  87. data/lib/ohai/plugins/linux/mdadm.rb +1 -0
  88. data/lib/ohai/plugins/linux/memory.rb +37 -36
  89. data/lib/ohai/plugins/linux/network.rb +30 -4
  90. data/lib/ohai/plugins/linux/platform.rb +6 -2
  91. data/lib/ohai/plugins/linux/selinux.rb +1 -0
  92. data/lib/ohai/plugins/linux/sessions.rb +1 -0
  93. data/lib/ohai/plugins/linux/sysctl.rb +1 -0
  94. data/lib/ohai/plugins/linux/systemd_paths.rb +1 -0
  95. data/lib/ohai/plugins/linux/virtualization.rb +1 -0
  96. data/lib/ohai/plugins/lua.rb +1 -1
  97. data/lib/ohai/plugins/mono.rb +1 -1
  98. data/lib/ohai/plugins/netbsd/memory.rb +1 -0
  99. data/lib/ohai/plugins/netbsd/network.rb +1 -0
  100. data/lib/ohai/plugins/netbsd/platform.rb +3 -2
  101. data/lib/ohai/plugins/network.rb +2 -1
  102. data/lib/ohai/plugins/nodejs.rb +1 -1
  103. data/lib/ohai/plugins/ohai.rb +1 -0
  104. data/lib/ohai/plugins/ohai_time.rb +1 -0
  105. data/lib/ohai/plugins/openbsd/memory.rb +1 -0
  106. data/lib/ohai/plugins/openbsd/network.rb +1 -0
  107. data/lib/ohai/plugins/openbsd/platform.rb +3 -2
  108. data/lib/ohai/plugins/openstack.rb +1 -0
  109. data/lib/ohai/plugins/os.rb +2 -1
  110. data/lib/ohai/plugins/packages.rb +2 -1
  111. data/lib/ohai/plugins/passwd.rb +2 -1
  112. data/lib/ohai/plugins/perl.rb +1 -1
  113. data/lib/ohai/plugins/php.rb +1 -1
  114. data/lib/ohai/plugins/platform.rb +1 -0
  115. data/lib/ohai/plugins/powershell.rb +1 -1
  116. data/lib/ohai/plugins/ps.rb +1 -0
  117. data/lib/ohai/plugins/python.rb +1 -1
  118. data/lib/ohai/plugins/rackspace.rb +6 -5
  119. data/lib/ohai/plugins/root_group.rb +1 -0
  120. data/lib/ohai/plugins/ruby.rb +3 -2
  121. data/lib/ohai/plugins/rust.rb +1 -1
  122. data/lib/ohai/plugins/scala.rb +1 -0
  123. data/lib/ohai/plugins/scaleway.rb +2 -1
  124. data/lib/ohai/plugins/scsi.rb +1 -1
  125. data/lib/ohai/plugins/shard.rb +1 -1
  126. data/lib/ohai/plugins/shells.rb +1 -0
  127. data/lib/ohai/plugins/softlayer.rb +1 -0
  128. data/lib/ohai/plugins/solaris2/dmi.rb +1 -0
  129. data/lib/ohai/plugins/solaris2/memory.rb +1 -0
  130. data/lib/ohai/plugins/solaris2/network.rb +2 -1
  131. data/lib/ohai/plugins/solaris2/platform.rb +6 -12
  132. data/lib/ohai/plugins/solaris2/virtualization.rb +3 -3
  133. data/lib/ohai/plugins/ssh_host_key.rb +1 -0
  134. data/lib/ohai/plugins/sysconf.rb +1 -0
  135. data/lib/ohai/plugins/timezone.rb +1 -0
  136. data/lib/ohai/plugins/train.rb +1 -1
  137. data/lib/ohai/plugins/uptime.rb +2 -1
  138. data/lib/ohai/plugins/virtualbox.rb +2 -1
  139. data/lib/ohai/plugins/vmware.rb +2 -2
  140. data/lib/ohai/plugins/windows/dmi.rb +1 -0
  141. data/lib/ohai/plugins/windows/drivers.rb +1 -0
  142. data/lib/ohai/plugins/windows/memory.rb +1 -0
  143. data/lib/ohai/plugins/windows/network.rb +2 -1
  144. data/lib/ohai/plugins/windows/platform.rb +1 -0
  145. data/lib/ohai/plugins/windows/system_enclosure.rb +1 -0
  146. data/lib/ohai/plugins/windows/virtualization.rb +1 -0
  147. data/lib/ohai/plugins/zpools.rb +5 -3
  148. data/lib/ohai/provides_map.rb +1 -0
  149. data/lib/ohai/runner.rb +3 -4
  150. data/lib/ohai/system.rb +1 -0
  151. data/lib/ohai/train_transport.rb +1 -0
  152. data/lib/ohai/util/file_helper.rb +1 -0
  153. data/lib/ohai/util/ip_helper.rb +2 -1
  154. data/lib/ohai/util/win32.rb +1 -0
  155. data/lib/ohai/version.rb +2 -1
  156. data/ohai.gemspec +2 -1
  157. metadata +14 -14
  158. data/lib/ohai/plugins/joyent.rb +0 -77
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Cookbook Name:: apache2
3
4
  # Recipe:: default
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Benjamin Black (<bb@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -16,11 +17,11 @@
16
17
  # limitations under the License.
17
18
  #
18
19
 
19
- # Note: This plugin requires libvirt-bin/libvirt-dev as well as the ruby-libvirt
20
+ # NOTE: This plugin requires libvirt-bin/libvirt-dev as well as the ruby-libvirt
20
21
  # gem to be installed before it will properly parse data
21
22
 
22
23
  Ohai.plugin(:Libvirt) do
23
- %w{ uri capabilities nodeinfo domains networks storage }.each do |info|
24
+ %w{uri capabilities nodeinfo domains networks storage}.each do |info|
24
25
  provides "libvirt/#{info}"
25
26
  depends "virtualization"
26
27
  end
@@ -88,7 +89,7 @@ Ohai.plugin(:Libvirt) do
88
89
  storage_data
89
90
  end
90
91
 
91
- collect_data do
92
+ collect_data(:linux) do
92
93
  if virtualization[:role].eql?("host")
93
94
  load_libvirt
94
95
  begin
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Aaron Kalin (<akalin@martinisoftware.com>)
3
4
  # License:: Apache License, Version 2.0
@@ -17,31 +18,38 @@
17
18
  Ohai.plugin(:Linode) do
18
19
  provides "linode"
19
20
 
20
- depends "kernel"
21
+ depends "domain"
21
22
  depends "network/interfaces"
22
23
 
23
- # Checks for matching linode kernel name
24
+ # Checks to see if the node is in the members.linode.com domain
24
25
  #
25
- # Returns true or false
26
- def has_linode_kernel?
27
- if ( kernel_data = kernel )
28
- kernel_data[:release].split("-").last.include?("linode")
29
- end
26
+ # @return [Boolean]
27
+ #
28
+ def has_linode_domain?
29
+ domain&.include?("linode")
30
+ end
31
+
32
+ # Checks for linode mirrors in the apt sources.list file
33
+ #
34
+ # @return [Boolean]
35
+ #
36
+ def has_linode_apt_repos?
37
+ file_exist?("/etc/apt/sources.list") && file_read("/etc/apt/sources.list").include?("linode")
30
38
  end
31
39
 
32
40
  # Identifies the linode cloud by preferring the hint, then
33
41
  #
34
- # Returns true or false
42
+ # @return [Boolean]
43
+ #
35
44
  def looks_like_linode?
36
- hint?("linode") || has_linode_kernel?
45
+ hint?("linode") || has_linode_domain? || has_linode_apt_repos?
37
46
  end
38
47
 
39
- # Names linode ip address
48
+ # Alters linode mash with new interface based on name parameter
40
49
  #
41
- # name - symbol of ohai name (e.g. :public_ip)
42
- # eth - Interface name (e.g. :eth0)
50
+ # @param [Symbol] name Ohai name (e.g. :public_ip)
51
+ # @param [Symbol] eth Interface name (e.g. :eth0)
43
52
  #
44
- # Alters linode mash with new interface based on name parameter
45
53
  def get_ip_address(name, eth)
46
54
  if ( eth_iface = network[:interfaces][eth] )
47
55
  eth_iface[:addresses].each do |key, info|
@@ -50,7 +58,7 @@ Ohai.plugin(:Linode) do
50
58
  end
51
59
  end
52
60
 
53
- collect_data do
61
+ collect_data(:linux) do
54
62
  # Setup linode mash if it is a linode system
55
63
  if looks_like_linode?
56
64
  logger.trace("Plugin Linode: looks_like_linode? == true")
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Davide Cavalca (<dcavalca@fb.com>)
3
4
  # Copyright:: Copyright (c) 2016 Facebook
@@ -25,8 +26,8 @@ Ohai.plugin(:Hostnamectl) do
25
26
  hostnamectl_path = which("hostnamectl")
26
27
  if hostnamectl_path
27
28
  shell_out(hostnamectl_path).stdout.split("\n").each do |line|
28
- key, val = line.split(":")
29
- hostnamectl[key.chomp.lstrip.tr(" ", "_").downcase] = val.chomp.lstrip
29
+ key, val = line.split(": ", 2)
30
+ hostnamectl[key.chomp.lstrip.tr(" ", "_").downcase] = val
30
31
  end
31
32
  end
32
33
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Davide Cavalca <dcavalca@fb.com>
3
4
  # Copyright:: Copyright (c) 2020 Facebook
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Jay Vana <jsvana@fb.com>
3
4
  # Author:: Davide Cavalca <dcavalca@fb.com>
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -26,34 +27,20 @@ Ohai.plugin(:LSB) do
26
27
  # From package redhat-lsb on Fedora/Redhat, lsb-release on Debian/Ubuntu
27
28
  shell_out("lsb_release -a").stdout.lines do |line|
28
29
  case line
29
- when /^Distributor ID:\s+(.+)$/
30
+ when /^Distributor ID:\s+(.+)/
30
31
  lsb[:id] = $1
31
- when /^Description:\s+(.+)$/
32
+ when /^Description:\s+(.+)/
32
33
  lsb[:description] = $1
33
- when /^Release:\s+(.+)$/
34
+ when /^Release:\s+(.+)/
34
35
  lsb[:release] = $1
35
- when /^Codename:\s+(.+)$/
36
+ when /^Codename:\s+(.+)/
36
37
  lsb[:codename] = $1
37
38
  else
38
39
  lsb[:id] = line
39
40
  end
40
41
  end
41
- elsif file_exist?("/etc/lsb-release")
42
- # Old, non-standard Debian support
43
- file_open("/etc/lsb-release").each do |line|
44
- case line
45
- when /^DISTRIB_ID=["']?(.+?)["']?$/
46
- lsb[:id] = $1
47
- when /^DISTRIB_RELEASE=["']?(.+?)["']?$/
48
- lsb[:release] = $1
49
- when /^DISTRIB_CODENAME=["']?(.+?)["']?$/
50
- lsb[:codename] = $1
51
- when /^DISTRIB_DESCRIPTION=["']?(.+?)["']?$/
52
- lsb[:description] = $1
53
- end
54
- end
55
42
  else
56
- logger.trace("Plugin LSB: Skipping LSB, cannot find /etc/lsb-release or /usr/bin/lsb_release")
43
+ logger.trace("Plugin LSB: Skipping LSB, cannot find /usr/bin/lsb_release")
57
44
  end
58
45
  end
59
46
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Joerg Herzinger <joerg.herzinger@oiml.at>
3
4
  # Author:: Phil Dibowitz <phil@ipom.com>
@@ -18,7 +19,6 @@
18
19
  # limitations under the License.
19
20
 
20
21
  Ohai.plugin(:Lspci) do
21
- depends "platform"
22
22
  provides "pci"
23
23
  optional true
24
24
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Davide Cavalca (<dcavalca@fb.com>)
3
4
  # Copyright:: Copyright (c) 2016 Facebook
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Tim Smith <tsmith@limelight.com>
3
4
  # Author:: Phil Dibowitz <phild@ipomc.com>
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -27,77 +28,77 @@ Ohai.plugin(:Memory) do
27
28
 
28
29
  file_open("/proc/meminfo").each do |line|
29
30
  case line
30
- when /^MemTotal:\s+(\d+) (.+)$/
31
+ when /^MemTotal:\s+(\d+) (.+)/
31
32
  memory[:total] = "#{$1}#{$2}"
32
- when /^MemFree:\s+(\d+) (.+)$/
33
+ when /^MemFree:\s+(\d+) (.+)/
33
34
  memory[:free] = "#{$1}#{$2}"
34
- when /^MemAvailable:\s+(\d+) (.+)$/
35
+ when /^MemAvailable:\s+(\d+) (.+)/
35
36
  memory[:available] = "#{$1}#{$2}"
36
- when /^Buffers:\s+(\d+) (.+)$/
37
+ when /^Buffers:\s+(\d+) (.+)/
37
38
  memory[:buffers] = "#{$1}#{$2}"
38
- when /^Cached:\s+(\d+) (.+)$/
39
+ when /^Cached:\s+(\d+) (.+)/
39
40
  memory[:cached] = "#{$1}#{$2}"
40
- when /^Active:\s+(\d+) (.+)$/
41
+ when /^Active:\s+(\d+) (.+)/
41
42
  memory[:active] = "#{$1}#{$2}"
42
- when /^Inactive:\s+(\d+) (.+)$/
43
+ when /^Inactive:\s+(\d+) (.+)/
43
44
  memory[:inactive] = "#{$1}#{$2}"
44
- when /^HighTotal:\s+(\d+) (.+)$/
45
+ when /^HighTotal:\s+(\d+) (.+)/
45
46
  memory[:high_total] = "#{$1}#{$2}"
46
- when /^HighFree:\s+(\d+) (.+)$/
47
+ when /^HighFree:\s+(\d+) (.+)/
47
48
  memory[:high_free] = "#{$1}#{$2}"
48
- when /^LowTotal:\s+(\d+) (.+)$/
49
+ when /^LowTotal:\s+(\d+) (.+)/
49
50
  memory[:low_total] = "#{$1}#{$2}"
50
- when /^LowFree:\s+(\d+) (.+)$/
51
+ when /^LowFree:\s+(\d+) (.+)/
51
52
  memory[:low_free] = "#{$1}#{$2}"
52
- when /^Dirty:\s+(\d+) (.+)$/
53
+ when /^Dirty:\s+(\d+) (.+)/
53
54
  memory[:dirty] = "#{$1}#{$2}"
54
- when /^Writeback:\s+(\d+) (.+)$/
55
+ when /^Writeback:\s+(\d+) (.+)/
55
56
  memory[:writeback] = "#{$1}#{$2}"
56
- when /^AnonPages:\s+(\d+) (.+)$/
57
+ when /^AnonPages:\s+(\d+) (.+)/
57
58
  memory[:anon_pages] = "#{$1}#{$2}"
58
- when /^Mapped:\s+(\d+) (.+)$/
59
+ when /^Mapped:\s+(\d+) (.+)/
59
60
  memory[:mapped] = "#{$1}#{$2}"
60
- when /^Slab:\s+(\d+) (.+)$/
61
+ when /^Slab:\s+(\d+) (.+)/
61
62
  memory[:slab] = "#{$1}#{$2}"
62
- when /^SReclaimable:\s+(\d+) (.+)$/
63
+ when /^SReclaimable:\s+(\d+) (.+)/
63
64
  memory[:slab_reclaimable] = "#{$1}#{$2}"
64
- when /^SUnreclaim:\s+(\d+) (.+)$/
65
+ when /^SUnreclaim:\s+(\d+) (.+)/
65
66
  memory[:slab_unreclaim] = "#{$1}#{$2}"
66
- when /^PageTables:\s+(\d+) (.+)$/
67
+ when /^PageTables:\s+(\d+) (.+)/
67
68
  memory[:page_tables] = "#{$1}#{$2}"
68
- when /^NFS_Unstable:\s+(\d+) (.+)$/
69
+ when /^NFS_Unstable:\s+(\d+) (.+)/
69
70
  memory[:nfs_unstable] = "#{$1}#{$2}"
70
- when /^Bounce:\s+(\d+) (.+)$/
71
+ when /^Bounce:\s+(\d+) (.+)/
71
72
  memory[:bounce] = "#{$1}#{$2}"
72
- when /^CommitLimit:\s+(\d+) (.+)$/
73
+ when /^CommitLimit:\s+(\d+) (.+)/
73
74
  memory[:commit_limit] = "#{$1}#{$2}"
74
- when /^Committed_AS:\s+(\d+) (.+)$/
75
+ when /^Committed_AS:\s+(\d+) (.+)/
75
76
  memory[:committed_as] = "#{$1}#{$2}"
76
- when /^VmallocTotal:\s+(\d+) (.+)$/
77
+ when /^VmallocTotal:\s+(\d+) (.+)/
77
78
  memory[:vmalloc_total] = "#{$1}#{$2}"
78
- when /^VmallocUsed:\s+(\d+) (.+)$/
79
+ when /^VmallocUsed:\s+(\d+) (.+)/
79
80
  memory[:vmalloc_used] = "#{$1}#{$2}"
80
- when /^VmallocChunk:\s+(\d+) (.+)$/
81
+ when /^VmallocChunk:\s+(\d+) (.+)/
81
82
  memory[:vmalloc_chunk] = "#{$1}#{$2}"
82
- when /^SwapCached:\s+(\d+) (.+)$/
83
+ when /^SwapCached:\s+(\d+) (.+)/
83
84
  memory[:swap][:cached] = "#{$1}#{$2}"
84
- when /^SwapTotal:\s+(\d+) (.+)$/
85
+ when /^SwapTotal:\s+(\d+) (.+)/
85
86
  memory[:swap][:total] = "#{$1}#{$2}"
86
- when /^SwapFree:\s+(\d+) (.+)$/
87
+ when /^SwapFree:\s+(\d+) (.+)/
87
88
  memory[:swap][:free] = "#{$1}#{$2}"
88
- when /^HugePages_Total:\s+(\d+)$/
89
+ when /^HugePages_Total:\s+(\d+)/
89
90
  memory[:hugepages][:total] = $1.to_s
90
- when /^HugePages_Free:\s+(\d+)$/
91
+ when /^HugePages_Free:\s+(\d+)/
91
92
  memory[:hugepages][:free] = $1.to_s
92
- when /^HugePages_Rsvd:\s+(\d+)$/
93
+ when /^HugePages_Rsvd:\s+(\d+)/
93
94
  memory[:hugepages][:reserved] = $1.to_s
94
- when /^HugePages_Surp:\s+(\d+)$/
95
+ when /^HugePages_Surp:\s+(\d+)/
95
96
  memory[:hugepages][:surplus] = $1.to_s
96
- when /^Hugepagesize:\s+(\d+) (.+)$/
97
+ when /^Hugepagesize:\s+(\d+) (.+)/
97
98
  memory[:hugepage_size] = "#{$1}#{$2}"
98
- when /^Hugetlb:\s+(\d+) (.+)$/
99
+ when /^Hugetlb:\s+(\d+) (.+)/
99
100
  memory[:hugetlb] = "#{$1}#{$2}"
100
- when /^DirectMap([0-9]+[a-zA-Z]):\s+(\d+) (.+)$/
101
+ when /^DirectMap([0-9]+[a-zA-Z]):\s+(\d+) (.+)/
101
102
  memory[:directmap][$1.to_sym] = "#{$2}#{$3}"
102
103
  end
103
104
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Author:: Chris Read <chris.read@gmail.com>
@@ -153,7 +154,7 @@ Ohai.plugin(:Network) do
153
154
  def ethernet_layer_one(iface)
154
155
  return iface unless ethtool_binary_path
155
156
 
156
- keys = %w{ Speed Duplex Port Transceiver Auto-negotiation MDI-X }
157
+ keys = %w{Speed Duplex Port Transceiver Auto-negotiation MDI-X}
157
158
  iface.each_key do |tmp_int|
158
159
  next unless iface[tmp_int][:encapsulation] == "Ethernet"
159
160
 
@@ -272,6 +273,30 @@ Ohai.plugin(:Network) do
272
273
  iface
273
274
  end
274
275
 
276
+ # determine pause parameters for the interface using ethtool
277
+ def ethernet_pause_parameters(iface)
278
+ return iface unless ethtool_binary_path
279
+
280
+ iface.each_key do |tmp_int|
281
+ next unless iface[tmp_int][:encapsulation] == "Ethernet"
282
+
283
+ so = shell_out("#{ethtool_binary_path} -a #{tmp_int}")
284
+ logger.trace("Plugin Network: Parsing ethtool output: #{so.stdout}")
285
+ iface[tmp_int]["pause_params"] = {}
286
+ so.stdout.lines.each do |line|
287
+ next if line.start_with?("Pause parameters for")
288
+ next if line.strip.nil?
289
+
290
+ key, val = line.split(/:\s+/)
291
+ if val
292
+ pause_key = "#{key.downcase.tr(" ", "_")}"
293
+ iface[tmp_int]["pause_params"][pause_key] = val.strip.eql? "on"
294
+ end
295
+ end
296
+ end
297
+ iface
298
+ end
299
+
275
300
  # determine driver info for the interface using ethtool
276
301
  def ethernet_driver_info(iface)
277
302
  return iface unless ethtool_binary_path
@@ -384,7 +409,7 @@ Ohai.plugin(:Network) do
384
409
  if line =~ IPROUTE_INT_REGEX
385
410
  cint = $2
386
411
  iface[cint] = Mash.new
387
- if cint =~ /^(\w+)(\d+.*)/
412
+ if cint =~ /^(\w+?)(\d+.*)/
388
413
  iface[cint][:type] = $1
389
414
  iface[cint][:number] = $2
390
415
  end
@@ -465,7 +490,7 @@ Ohai.plugin(:Network) do
465
490
  iface[cint][:addresses] ||= Mash.new
466
491
  tmp_addr = $1
467
492
  tags = $4 || ""
468
- tags = tags.split(" ")
493
+ tags = tags.split
469
494
 
470
495
  iface[cint][:addresses][tmp_addr] = {
471
496
  "family" => "inet6",
@@ -695,7 +720,7 @@ Ohai.plugin(:Network) do
695
720
  if line =~ /^([0-9a-zA-Z@\.\:\-_]+)\s+/
696
721
  cint = $1
697
722
  iface[cint] = Mash.new
698
- if cint =~ /^(\w+)(\d+.*)/
723
+ if cint =~ /^(\w+?)(\d+.*)/
699
724
  iface[cint][:type] = $1
700
725
  iface[cint][:number] = $2
701
726
  end
@@ -769,6 +794,7 @@ Ohai.plugin(:Network) do
769
794
  iface = ethernet_channel_parameters(iface)
770
795
  iface = ethernet_coalesce_parameters(iface)
771
796
  iface = ethernet_driver_info(iface)
797
+ iface = ethernet_pause_parameters(iface)
772
798
  counters[:network][:interfaces] = net_counters
773
799
  network["interfaces"] = iface
774
800
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Adam Jacob (<adam@chef.io>)
3
4
  # Copyright:: Copyright (c) Chef Software Inc.
@@ -132,10 +133,10 @@ Ohai.plugin(:Platform) do
132
133
  #
133
134
  def platform_family_from_platform(plat)
134
135
  case plat
135
- when /debian/, /ubuntu/, /linuxmint/, /raspbian/, /cumulus/, /kali/
136
+ when /debian/, /ubuntu/, /linuxmint/, /raspbian/, /cumulus/, /kali/, /pop/
136
137
  # apt-get+dpkg almost certainly goes here
137
138
  "debian"
138
- when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /xcp/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/, /bigip/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
139
+ when /oracle/, /centos/, /redhat/, /almalinux/, /scientific/, /enterpriseenterprise/, /xcp/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/, /bigip/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
139
140
  # NOTE: "rhel" should be reserved exclusively for recompiled rhel versions that are nearly perfectly compatible down to the platform_version.
140
141
  # The operating systems that are "rhel" should all be as compatible as rhel7 = centos7 = oracle7 = scientific7 (98%-ish core RPM version compatibility
141
142
  # and the version numbers MUST track the upstream). The appropriate EPEL version repo should work nearly perfectly. Some variation like the
@@ -286,6 +287,9 @@ Ohai.plugin(:Platform) do
286
287
  # centos only includes the major version in os-release for some reason
287
288
  if os_release_info["ID"] == "centos"
288
289
  get_redhatish_version(file_read("/etc/redhat-release").chomp)
290
+ # debian testing and unstable don't have VERSION_ID set
291
+ elsif os_release_info["ID"] == "debian"
292
+ os_release_info["VERSION_ID"] || file_read("/etc/debian_version").chomp
289
293
  else
290
294
  os_release_info["VERSION_ID"] || shell_out("/bin/uname -r").stdout.strip
291
295
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Davide Cavalca <dcavalca@fb.com>
3
4
  # Copyright:: Copyright (c) 2020 Facebook
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Davide Cavalca <dcavalca@fb.com>
3
4
  # Copyright:: Copyright (c) 2016 Facebook