ohai 16.10.7 → 16.12.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c661e4c6ab76f9c2e8e8fb2ae7d287caa31d81c1b3149f689c8d00853d392488
4
- data.tar.gz: e48961c413eafcbb0af751b34b9fb7dd805ae2e7d0650dcecbf1cf2b8adbe691
3
+ metadata.gz: a3157ed0544a09a2be70af496e0b3f36fa538a82b1186555f8380c42ba38bcc6
4
+ data.tar.gz: 433621ca5500cff124015f57d6ba2e4a7479579b44f18918961eb04bec8300c2
5
5
  SHA512:
6
- metadata.gz: 72849d5d2c327b4994aa073d85556bbd3b2a0ef200646593a2f62cc283c39ee435b99a81c87f56b31583dbf99e174a365d08c634ee91863d0a19b1c0d261f40e
7
- data.tar.gz: c5104a84a7067fff9dde9d5e456107e300bd5e6f42dd3d42684ac491cdbaf511fb9c31741cf4763c0dbfeacc08008dc9f517568c31d1873ea7228b32bf33bcde
6
+ metadata.gz: d2eba25677fc4cbdeb090f7c05d86ddd240f02513d24b07204e5a6ffa79560125e8bf444f1ce8622bbac337076db4b3c6cf9e90ef58318ca49debfe829d35c73
7
+ data.tar.gz: 6e304286a016ae9d23467ab158f4bcf512e993e0e466124909d57fdc509a1c553ab8241b24f5a63f7347e954c1b5b3fa03d040003ede9586c45fdaaecb042067
@@ -20,9 +20,19 @@
20
20
  Ohai.plugin(:Chef) do
21
21
  provides "chef_packages/chef"
22
22
 
23
+ def chef_effortless?
24
+ # Determine if client is being run as a Habitat package.
25
+ if Chef::CHEF_ROOT.include?("hab/pkgs/chef/chef")
26
+ # Determine if client is running in zero mode which would show it is using the Effortless pattern.
27
+ # Explicitly set response to true or nil, not false
28
+ ChefConfig::Config["chef_server_url"].include?("chefzero://")
29
+ end
30
+ end
31
+
23
32
  collect_data(:default, :target) do
24
33
  begin
25
34
  require "chef/version"
35
+ require "chef-config/config" unless defined?(ChefConfig::Config)
26
36
  rescue Gem::LoadError
27
37
  logger.trace("Plugin Chef: Unable to load the chef gem to determine the version")
28
38
  # this catches when you've done a major version bump of ohai, but
@@ -35,5 +45,6 @@ Ohai.plugin(:Chef) do
35
45
  chef_packages[:chef] = Mash.new
36
46
  chef_packages[:chef][:version] = Chef::VERSION
37
47
  chef_packages[:chef][:chef_root] = Chef::CHEF_ROOT
48
+ chef_packages[:chef][:chef_effortless] = chef_effortless?
38
49
  end
39
50
  end
@@ -112,15 +112,16 @@ Ohai.plugin(:Platform) do
112
112
  # ohai uses. If you're adding a new platform here and you want to change the name
113
113
  # you'll want to add it here and then add a spec for the platform_id_remap method
114
114
  {
115
- "rhel" => "redhat",
115
+ "alinux" => "alibabalinux",
116
116
  "amzn" => "amazon",
117
+ "archarm" => "arch",
118
+ "cumulus-linux" => "cumulus",
117
119
  "ol" => "oracle",
118
- "sles" => "suse",
119
- "sles_sap" => "suse",
120
120
  "opensuse-leap" => "opensuseleap",
121
+ "rhel" => "redhat",
122
+ "sles_sap" => "suse",
123
+ "sles" => "suse",
121
124
  "xenenterprise" => "xenserver",
122
- "cumulus-linux" => "cumulus",
123
- "archarm" => "arch",
124
125
  }[id] || id
125
126
  end
126
127
 
@@ -136,7 +137,7 @@ Ohai.plugin(:Platform) do
136
137
  when /debian/, /ubuntu/, /linuxmint/, /raspbian/, /cumulus/, /kali/, /pop/
137
138
  # apt-get+dpkg almost certainly goes here
138
139
  "debian"
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"
140
+ when /oracle/, /centos/, /redhat/, /almalinux/, /scientific/, /enterpriseenterprise/, /xcp/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/, /bigip/, /alibabalinux/, /sangoma/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
140
141
  # NOTE: "rhel" should be reserved exclusively for recompiled rhel versions that are nearly perfectly compatible down to the platform_version.
141
142
  # The operating systems that are "rhel" should all be as compatible as rhel7 = centos7 = oracle7 = scientific7 (98%-ish core RPM version compatibility
142
143
  # and the version numbers MUST track the upstream). The appropriate EPEL version repo should work nearly perfectly. Some variation like the
@@ -225,7 +225,11 @@ Ohai.plugin(:Virtualization) do
225
225
  # If so, we may need to look further for a differentiator (OHAI-573)
226
226
  virtualization[:systems][:lxc] = "host"
227
227
  end
228
- elsif file_exist?("/.dockerenv") || file_exist?("/.dockerinit")
228
+ end
229
+
230
+ # regardless of what we found above, if we're a docker container inside
231
+ # of the above, lets report as a docker container
232
+ if file_exist?("/.dockerenv") || file_exist?("/.dockerinit")
229
233
  logger.trace("Plugin Virtualization: .dockerenv or .dockerinit exist. Detecting as docker guest")
230
234
  virtualization[:system] = "docker"
231
235
  virtualization[:role] = "guest"
@@ -106,7 +106,7 @@ Ohai.plugin(:Packages) do
106
106
  end
107
107
  end
108
108
 
109
- def collect_programs_from_registry_key(key_path)
109
+ def collect_programs_from_registry_key(repo, key_path)
110
110
  # from http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx
111
111
  if ::RbConfig::CONFIG["target_cpu"] == "i386"
112
112
  reg_type = Win32::Registry::KEY_READ | 0x100
@@ -115,7 +115,7 @@ Ohai.plugin(:Packages) do
115
115
  else
116
116
  reg_type = Win32::Registry::KEY_READ
117
117
  end
118
- Win32::Registry::HKEY_LOCAL_MACHINE.open(key_path, reg_type) do |reg|
118
+ repo.open(key_path, reg_type) do |reg|
119
119
  reg.each_key do |key, _wtime|
120
120
  pkg = reg.open(key)
121
121
  name = pkg["DisplayName"] rescue nil
@@ -133,9 +133,10 @@ Ohai.plugin(:Packages) do
133
133
  collect_data(:windows) do
134
134
  require "win32/registry" unless defined?(Win32::Registry)
135
135
  packages Mash.new
136
- collect_programs_from_registry_key('Software\Microsoft\Windows\CurrentVersion\Uninstall')
136
+ collect_programs_from_registry_key(Win32::Registry::HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall')
137
+ collect_programs_from_registry_key(Win32::Registry::HKEY_CURRENT_USER, 'Software\Microsoft\Windows\CurrentVersion\Uninstall')
138
+ collect_programs_from_registry_key(Win32::Registry::HKEY_LOCAL_MACHINE, 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall')
137
139
  # on 64 bit systems, 32 bit programs are stored here
138
- collect_programs_from_registry_key('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall')
139
140
  end
140
141
 
141
142
  collect_data(:aix) do
data/lib/ohai/version.rb CHANGED
@@ -19,5 +19,5 @@
19
19
 
20
20
  module Ohai
21
21
  OHAI_ROOT = File.expand_path(__dir__)
22
- VERSION = "16.10.7"
22
+ VERSION = "16.12.3"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.10.7
4
+ version: 16.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-27 00:00:00.000000000 Z
11
+ date: 2021-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config