ohai 8.10.0 → 8.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/Rakefile +13 -4
- data/bin/ohai +3 -4
- data/lib/ohai.rb +4 -4
- data/lib/ohai/application.rb +7 -6
- data/lib/ohai/common/dmi.rb +56 -56
- data/lib/ohai/config.rb +12 -8
- data/lib/ohai/dsl.rb +3 -3
- data/lib/ohai/dsl/plugin.rb +5 -5
- data/lib/ohai/dsl/plugin/versionvi.rb +0 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -0
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +7 -7
- data/lib/ohai/log.rb +1 -1
- data/lib/ohai/mash.rb +3 -2
- data/lib/ohai/mixin/command.rb +25 -23
- data/lib/ohai/mixin/dmi_decode.rb +10 -10
- data/lib/ohai/mixin/ec2_metadata.rb +40 -39
- data/lib/ohai/mixin/gce_metadata.rb +9 -9
- data/lib/ohai/mixin/network_constants.rb +1 -1
- data/lib/ohai/mixin/os.rb +3 -3
- data/lib/ohai/mixin/seconds_to_human.rb +0 -2
- data/lib/ohai/mixin/softlayer_metadata.rb +10 -10
- data/lib/ohai/mixin/string.rb +2 -2
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/cpu.rb +2 -2
- data/lib/ohai/plugins/aix/filesystem.rb +2 -2
- data/lib/ohai/plugins/aix/memory.rb +2 -2
- data/lib/ohai/plugins/aix/network.rb +9 -10
- data/lib/ohai/plugins/aix/os.rb +2 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -3
- data/lib/ohai/plugins/aix/virtualization.rb +23 -23
- data/lib/ohai/plugins/azure.rb +32 -5
- data/lib/ohai/plugins/bsd/virtualization.rb +22 -22
- data/lib/ohai/plugins/c.rb +3 -3
- data/lib/ohai/plugins/chef.rb +1 -1
- data/lib/ohai/plugins/cloud.rb +59 -60
- data/lib/ohai/plugins/cloud_v2.rb +37 -39
- data/lib/ohai/plugins/darwin/cpu.rb +1 -1
- data/lib/ohai/plugins/darwin/filesystem2.rb +5 -5
- data/lib/ohai/plugins/darwin/memory.rb +5 -6
- data/lib/ohai/plugins/darwin/network.rb +7 -7
- data/lib/ohai/plugins/darwin/system_profiler.rb +32 -33
- data/lib/ohai/plugins/darwin/virtualization.rb +9 -9
- data/lib/ohai/plugins/digital_ocean.rb +16 -16
- data/lib/ohai/plugins/dmi.rb +6 -6
- data/lib/ohai/plugins/dragonflybsd/cpu.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/memory.rb +0 -1
- data/lib/ohai/plugins/dragonflybsd/network.rb +4 -4
- data/lib/ohai/plugins/dragonflybsd/os.rb +1 -1
- data/lib/ohai/plugins/ec2.rb +39 -15
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +3 -3
- data/lib/ohai/plugins/eucalyptus.rb +16 -12
- data/lib/ohai/plugins/freebsd/cpu.rb +2 -2
- data/lib/ohai/plugins/freebsd/memory.rb +0 -1
- data/lib/ohai/plugins/freebsd/network.rb +4 -4
- data/lib/ohai/plugins/freebsd/os.rb +1 -1
- data/lib/ohai/plugins/gce.rb +6 -6
- data/lib/ohai/plugins/hostname.rb +7 -7
- data/lib/ohai/plugins/init_package.rb +1 -1
- data/lib/ohai/plugins/ip_scopes.rb +9 -9
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/joyent.rb +7 -7
- data/lib/ohai/plugins/kernel.rb +8 -8
- data/lib/ohai/plugins/linode.rb +7 -4
- data/lib/ohai/plugins/linux/cpu.rb +5 -5
- data/lib/ohai/plugins/linux/filesystem.rb +16 -16
- data/lib/ohai/plugins/linux/filesystem2.rb +15 -15
- data/lib/ohai/plugins/linux/mdadm.rb +3 -3
- data/lib/ohai/plugins/linux/network.rb +85 -51
- data/lib/ohai/plugins/linux/platform.rb +24 -24
- data/lib/ohai/plugins/linux/virtualization.rb +8 -8
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/netbsd/cpu.rb +1 -1
- data/lib/ohai/plugins/netbsd/network.rb +2 -2
- data/lib/ohai/plugins/network.rb +11 -11
- data/lib/ohai/plugins/network_listeners.rb +30 -26
- data/lib/ohai/plugins/ohai.rb +3 -3
- data/lib/ohai/plugins/openbsd/cpu.rb +4 -4
- data/lib/ohai/plugins/openbsd/memory.rb +4 -4
- data/lib/ohai/plugins/openbsd/network.rb +3 -3
- data/lib/ohai/plugins/openstack.rb +12 -12
- data/lib/ohai/plugins/os.rb +2 -2
- data/lib/ohai/plugins/packages.rb +22 -22
- data/lib/ohai/plugins/passwd.rb +4 -4
- data/lib/ohai/plugins/powershell.rb +9 -9
- data/lib/ohai/plugins/ps.rb +2 -2
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +13 -13
- data/lib/ohai/plugins/root_group.rb +4 -4
- data/lib/ohai/plugins/ruby.rb +6 -6
- data/lib/ohai/plugins/rust.rb +1 -1
- data/lib/ohai/plugins/sigar/cpu.rb +1 -1
- data/lib/ohai/plugins/sigar/filesystem.rb +1 -1
- data/lib/ohai/plugins/sigar/network.rb +13 -13
- data/lib/ohai/plugins/sigar/network_route.rb +34 -29
- data/lib/ohai/plugins/softlayer.rb +8 -7
- data/lib/ohai/plugins/solaris2/cpu.rb +19 -19
- data/lib/ohai/plugins/solaris2/dmi.rb +63 -63
- data/lib/ohai/plugins/solaris2/filesystem.rb +13 -13
- data/lib/ohai/plugins/solaris2/memory.rb +2 -2
- data/lib/ohai/plugins/solaris2/network.rb +5 -5
- data/lib/ohai/plugins/solaris2/virtualization.rb +18 -18
- data/lib/ohai/plugins/solaris2/zpools.rb +1 -1
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +4 -5
- data/lib/ohai/plugins/virtualbox.rb +2 -2
- data/lib/ohai/plugins/virtualization.rb +17 -17
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/cpu.rb +14 -14
- data/lib/ohai/plugins/windows/drivers.rb +8 -8
- data/lib/ohai/plugins/windows/filesystem.rb +4 -4
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +10 -10
- data/lib/ohai/plugins/windows/platform.rb +1 -2
- data/lib/ohai/plugins/windows/virtualization.rb +17 -17
- data/lib/ohai/provides_map.rb +7 -7
- data/lib/ohai/runner.rb +3 -3
- data/lib/ohai/system.rb +21 -20
- data/lib/ohai/util/file_helper.rb +1 -2
- data/lib/ohai/util/ip_helper.rb +4 -4
- data/lib/ohai/util/win32.rb +5 -5
- data/lib/ohai/util/win32/group_helper.rb +4 -5
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +7 -5
- data/spec/functional/application_spec.rb +23 -23
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +13 -13
- data/spec/functional/plugins/root_group_spec.rb +5 -5
- data/spec/ohai_spec.rb +1 -1
- data/spec/spec_helper.rb +9 -9
- data/spec/support/integration_helper.rb +7 -7
- data/spec/support/platform_helpers.rb +1 -1
- data/spec/unit/application_spec.rb +17 -17
- data/spec/unit/config_spec.rb +2 -2
- data/spec/unit/dsl/plugin_spec.rb +28 -28
- data/spec/unit/hints_spec.rb +3 -3
- data/spec/unit/loader_spec.rb +9 -9
- data/spec/unit/mixin/command_spec.rb +5 -5
- data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
- data/spec/unit/mixin/softlayer_metadata_spec.rb +19 -23
- data/spec/unit/plugin_config_spec.rb +5 -5
- data/spec/unit/plugins/abort_spec.rb +3 -3
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +25 -25
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -2
- data/spec/unit/plugins/aix/kernel_spec.rb +3 -3
- data/spec/unit/plugins/aix/memory_spec.rb +8 -8
- data/spec/unit/plugins/aix/network_spec.rb +38 -38
- data/spec/unit/plugins/aix/os_spec.rb +1 -2
- data/spec/unit/plugins/aix/platform_spec.rb +1 -1
- data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +11 -11
- data/spec/unit/plugins/azure_spec.rb +118 -20
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +4 -4
- data/spec/unit/plugins/c_spec.rb +12 -12
- data/spec/unit/plugins/chef_spec.rb +2 -2
- data/spec/unit/plugins/cloud_spec.rb +37 -37
- data/spec/unit/plugins/cloud_v2_spec.rb +64 -65
- data/spec/unit/plugins/darwin/cpu_spec.rb +1 -2
- data/spec/unit/plugins/darwin/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -4
- data/spec/unit/plugins/darwin/kernel_spec.rb +6 -10
- data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
- data/spec/unit/plugins/darwin/network_spec.rb +352 -353
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -2
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +3 -3
- data/spec/unit/plugins/darwin/virtualization_spec.rb +6 -6
- data/spec/unit/plugins/digital_ocean_spec.rb +38 -37
- data/spec/unit/plugins/dmi_spec.rb +3 -3
- data/spec/unit/plugins/ec2_spec.rb +97 -88
- data/spec/unit/plugins/elixir_spec.rb +1 -2
- data/spec/unit/plugins/erlang_spec.rb +2 -2
- data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
- data/spec/unit/plugins/fail_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/cpu_spec.rb +14 -14
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -3
- data/spec/unit/plugins/freebsd/os_spec.rb +4 -5
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/gce_spec.rb +9 -9
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -2
- data/spec/unit/plugins/hostname_spec.rb +1 -2
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/ip_scopes_spec.rb +38 -38
- data/spec/unit/plugins/java_spec.rb +52 -1
- data/spec/unit/plugins/joyent_spec.rb +9 -11
- data/spec/unit/plugins/kernel_spec.rb +11 -12
- data/spec/unit/plugins/linode_spec.rb +29 -29
- data/spec/unit/plugins/linux/block_device_spec.rb +21 -21
- data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
- data/spec/unit/plugins/linux/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/linux/filesystem_spec.rb +85 -86
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -3
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +1 -2
- data/spec/unit/plugins/linux/mdadm_spec.rb +4 -4
- data/spec/unit/plugins/linux/memory_spec.rb +29 -33
- data/spec/unit/plugins/linux/network_spec.rb +463 -245
- data/spec/unit/plugins/linux/platform_spec.rb +64 -65
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -2
- data/spec/unit/plugins/linux/virtualization_spec.rb +42 -42
- data/spec/unit/plugins/lua_spec.rb +1 -2
- data/spec/unit/plugins/mono_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +118 -118
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +1 -1
- data/spec/unit/plugins/ohai_time_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/openstack_spec.rb +35 -37
- data/spec/unit/plugins/os_spec.rb +7 -8
- data/spec/unit/plugins/packages_spec.rb +118 -118
- data/spec/unit/plugins/passwd_spec.rb +18 -18
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +4 -4
- data/spec/unit/plugins/platform_spec.rb +8 -9
- data/spec/unit/plugins/powershell_spec.rb +3 -3
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +66 -68
- data/spec/unit/plugins/root_group_spec.rb +26 -26
- data/spec/unit/plugins/ruby_spec.rb +14 -15
- data/spec/unit/plugins/rust_spec.rb +2 -2
- data/spec/unit/plugins/sigar/network_route_spec.rb +36 -36
- data/spec/unit/plugins/softlayer_spec.rb +10 -10
- data/spec/unit/plugins/solaris2/cpu_spec.rb +20 -21
- data/spec/unit/plugins/solaris2/dmi_spec.rb +5 -6
- data/spec/unit/plugins/solaris2/filesystem.rb +5 -5
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/memory_spec.rb +5 -5
- data/spec/unit/plugins/solaris2/network_spec.rb +7 -8
- data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +3 -5
- data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
- data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +19 -19
- data/spec/unit/plugins/vmware_spec.rb +28 -28
- data/spec/unit/plugins/windows/cpu_spec.rb +46 -48
- data/spec/unit/plugins/windows/memory_spec.rb +5 -5
- data/spec/unit/plugins/windows/virtualization_spec.rb +163 -163
- data/spec/unit/provides_map_spec.rb +10 -10
- data/spec/unit/runner_spec.rb +10 -10
- data/spec/unit/system_spec.rb +19 -19
- data/spec/unit/util/file_helper_spec.rb +5 -6
- data/spec/unit/util/ip_helper_spec.rb +39 -39
- metadata +31 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f773eb5ea1a32204f9cf602455776492dded72e5
|
4
|
+
data.tar.gz: 9a49d6bba8ea5058935e8a7f12d4ad204db71168
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 102f27a1df33f5049c3ca49ed6d4944281b65a2702cdbc11fd7dc2d62fb4fd185359581db7380936ec1d86bc04ca0224bdd6cd237f01695653ba3130b815d284
|
7
|
+
data.tar.gz: 148e626698de7337b8ebaf79b882786ead5a6d7ef04b71d475047c016874952a3f1d5bcae5ea97a2361d3bd354056f99a55833434b29d5d391c115075054320c
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "date"
|
3
|
+
require "ohai/version"
|
4
4
|
|
5
5
|
begin
|
6
|
-
require
|
6
|
+
require "rspec/core/rake_task"
|
7
7
|
|
8
8
|
RSpec::Core::RakeTask.new do |t|
|
9
|
-
t.pattern =
|
9
|
+
t.pattern = "spec/**/*_spec.rb"
|
10
10
|
end
|
11
11
|
rescue LoadError
|
12
12
|
desc "rspec is not installed, this task is disabled"
|
@@ -22,3 +22,12 @@ require "rubocop/rake_task"
|
|
22
22
|
RuboCop::RakeTask.new(:style) do |task|
|
23
23
|
task.options += ["--display-cop-names", "--no-color"]
|
24
24
|
end
|
25
|
+
|
26
|
+
require "github_changelog_generator/task"
|
27
|
+
|
28
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
29
|
+
config.future_release = Ohai::VERSION
|
30
|
+
config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
|
31
|
+
config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
|
32
|
+
config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",")
|
33
|
+
end
|
data/bin/ohai
CHANGED
@@ -19,9 +19,8 @@
|
|
19
19
|
# limitations under the License.
|
20
20
|
#
|
21
21
|
|
22
|
-
|
23
22
|
begin
|
24
|
-
require
|
23
|
+
require "rubygems"
|
25
24
|
rescue LoadError
|
26
25
|
# must be debian! ;)
|
27
26
|
missing_rubygems = true
|
@@ -29,8 +28,8 @@ end
|
|
29
28
|
begin
|
30
29
|
# if we're in a source code checkout, we want to run the code from that.
|
31
30
|
# have to do this *after* rubygems is loaded.
|
32
|
-
$:.unshift File.expand_path(
|
33
|
-
require
|
31
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
32
|
+
require "ohai/application"
|
34
33
|
rescue LoadError
|
35
34
|
if missing_rubygems
|
36
35
|
STDERR.puts "rubygems previously failed to load - is it installed?"
|
data/lib/ohai.rb
CHANGED
data/lib/ohai/application.rb
CHANGED
@@ -15,11 +15,11 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
18
|
+
require "chef-config/path_helper"
|
19
|
+
require "chef-config/workstation_config_loader"
|
20
|
+
require "ohai"
|
21
|
+
require "ohai/log"
|
22
|
+
require "mixlib/cli"
|
23
23
|
|
24
24
|
class Ohai::Application
|
25
25
|
include Mixlib::CLI
|
@@ -62,7 +62,7 @@ class Ohai::Application
|
|
62
62
|
:long => "--version",
|
63
63
|
:description => "Show Ohai version",
|
64
64
|
:boolean => true,
|
65
|
-
:proc => lambda {|v| puts "Ohai: #{::Ohai::VERSION}"},
|
65
|
+
:proc => lambda { |v| puts "Ohai: #{::Ohai::VERSION}" },
|
66
66
|
:exit => 0
|
67
67
|
|
68
68
|
def initialize
|
@@ -113,6 +113,7 @@ class Ohai::Application
|
|
113
113
|
end
|
114
114
|
|
115
115
|
private
|
116
|
+
|
116
117
|
def load_workstation_config
|
117
118
|
config_loader = ChefConfig::WorkstationConfigLoader.new(
|
118
119
|
config[:config_file], Ohai::Log
|
data/lib/ohai/common/dmi.rb
CHANGED
@@ -6,9 +6,9 @@
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -25,48 +25,48 @@ module Ohai
|
|
25
25
|
# 128-255 are 'oem_data_[id]'
|
26
26
|
# Everything else is 'unknown'
|
27
27
|
IdToDescription = {
|
28
|
-
0 =>
|
29
|
-
1 =>
|
30
|
-
2 =>
|
31
|
-
3 =>
|
32
|
-
4 =>
|
33
|
-
5 =>
|
34
|
-
6 =>
|
35
|
-
7 =>
|
36
|
-
8 =>
|
37
|
-
9 =>
|
38
|
-
10 =>
|
39
|
-
11 =>
|
40
|
-
12 =>
|
41
|
-
13 =>
|
42
|
-
14 =>
|
43
|
-
15 =>
|
44
|
-
16 =>
|
45
|
-
17 =>
|
46
|
-
18 =>
|
47
|
-
19 =>
|
48
|
-
20 =>
|
49
|
-
21 =>
|
50
|
-
22 =>
|
51
|
-
23 =>
|
52
|
-
24 =>
|
53
|
-
25 =>
|
54
|
-
26 =>
|
55
|
-
27 =>
|
56
|
-
28 =>
|
57
|
-
29 =>
|
58
|
-
30 =>
|
59
|
-
31 =>
|
60
|
-
32 =>
|
61
|
-
33 =>
|
62
|
-
34 =>
|
63
|
-
35 =>
|
64
|
-
36 =>
|
65
|
-
37 =>
|
66
|
-
38 =>
|
67
|
-
39 =>
|
68
|
-
126 =>
|
69
|
-
127 =>
|
28
|
+
0 => "bios",
|
29
|
+
1 => "system",
|
30
|
+
2 => "base_board",
|
31
|
+
3 => "chassis",
|
32
|
+
4 => "processor",
|
33
|
+
5 => "memory_controller",
|
34
|
+
6 => "memory_module",
|
35
|
+
7 => "cache",
|
36
|
+
8 => "port_connector",
|
37
|
+
9 => "system_slots",
|
38
|
+
10 => "on_board_devices",
|
39
|
+
11 => "oem_strings",
|
40
|
+
12 => "system_configuration_options",
|
41
|
+
13 => "bios_language",
|
42
|
+
14 => "group_associations",
|
43
|
+
15 => "system_event_log",
|
44
|
+
16 => "physical_memory_array",
|
45
|
+
17 => "memory_device",
|
46
|
+
18 => "32_bit_memory_error",
|
47
|
+
19 => "memory_array_mapped_address",
|
48
|
+
20 => "memory_device_mapped_address",
|
49
|
+
21 => "built_in_pointing_device",
|
50
|
+
22 => "portable_battery",
|
51
|
+
23 => "system_reset",
|
52
|
+
24 => "hardware_security",
|
53
|
+
25 => "system_power_controls",
|
54
|
+
26 => "voltage_probe",
|
55
|
+
27 => "cooling_device",
|
56
|
+
28 => "temperature_probe",
|
57
|
+
29 => "electrical_current_probe",
|
58
|
+
30 => "out_of_band_remote_access",
|
59
|
+
31 => "boot_integrity_services",
|
60
|
+
32 => "system_boot",
|
61
|
+
33 => "64_bit_memory_error",
|
62
|
+
34 => "management_device",
|
63
|
+
35 => "management_device_component",
|
64
|
+
36 => "management_device_threshold_data",
|
65
|
+
37 => "memory_channel",
|
66
|
+
38 => "ipmi_device",
|
67
|
+
39 => "power_supply",
|
68
|
+
126 => "disabled_entries",
|
69
|
+
127 => "end_of_table_marker",
|
70
70
|
}
|
71
71
|
|
72
72
|
# list of IDs to collect, otherwise we generate pages of hashes about cache chip size and whatnot
|
@@ -83,7 +83,7 @@ module Ohai
|
|
83
83
|
id = DMI::IdToDescription[id]
|
84
84
|
else
|
85
85
|
Ohai::Log.debug("unrecognized header id; falling back to 'unknown'")
|
86
|
-
id =
|
86
|
+
id = "unknown"
|
87
87
|
end
|
88
88
|
rescue
|
89
89
|
Ohai::Log.debug("failed to look up id #{id}, returning unchanged")
|
@@ -95,17 +95,17 @@ module Ohai
|
|
95
95
|
# for single occurrences of one type, copy to top level all fields and values
|
96
96
|
# for multiple occurrences of same type, copy to top level all fields and values that are common to all records
|
97
97
|
def convenience_keys(dmi)
|
98
|
-
dmi.each{ |type, records|
|
98
|
+
dmi.each { |type, records|
|
99
99
|
in_common = Mash.new
|
100
|
-
next unless records.class.to_s ==
|
101
|
-
next unless records.has_key?(
|
102
|
-
records[:all_records].each{ |record|
|
103
|
-
record.each{ |field, value|
|
104
|
-
next if value.class.to_s ==
|
105
|
-
next if field.to_s ==
|
106
|
-
next if field.to_s ==
|
107
|
-
next if field.to_s ==
|
108
|
-
translated = field.downcase.gsub(/[^a-z0-9]/,
|
100
|
+
next unless records.class.to_s == "Mash"
|
101
|
+
next unless records.has_key?("all_records")
|
102
|
+
records[:all_records].each { |record|
|
103
|
+
record.each { |field, value|
|
104
|
+
next if value.class.to_s == "Mash"
|
105
|
+
next if field.to_s == "application_identifier"
|
106
|
+
next if field.to_s == "size"
|
107
|
+
next if field.to_s == "record_id"
|
108
|
+
translated = field.downcase.gsub(/[^a-z0-9]/, "_")
|
109
109
|
value = value.strip
|
110
110
|
if in_common.has_key?(translated)
|
111
111
|
in_common[translated] = nil unless in_common[translated] == value
|
@@ -114,7 +114,7 @@ module Ohai
|
|
114
114
|
end
|
115
115
|
}
|
116
116
|
}
|
117
|
-
in_common.each{ |field, value|
|
117
|
+
in_common.each { |field, value|
|
118
118
|
next if value == nil
|
119
119
|
dmi[type][field] = value.strip
|
120
120
|
}
|
data/lib/ohai/config.rb
CHANGED
@@ -17,10 +17,10 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
20
|
+
require "chef-config/config"
|
21
|
+
require "ohai/exception"
|
22
|
+
require "ohai/log"
|
23
|
+
require "ohai/plugin_config"
|
24
24
|
|
25
25
|
module Ohai
|
26
26
|
Config = ChefConfig::Config
|
@@ -30,16 +30,19 @@ module Ohai
|
|
30
30
|
class Config
|
31
31
|
# These methods need to be defined before they are used as config defaults,
|
32
32
|
# otherwise they will get method_missing'd to nil.
|
33
|
+
|
33
34
|
private
|
35
|
+
|
34
36
|
def self.default_hints_path
|
35
|
-
[ ChefConfig::Config.platform_specific_path(
|
37
|
+
[ ChefConfig::Config.platform_specific_path("/etc/chef/ohai/hints") ]
|
36
38
|
end
|
37
39
|
|
38
40
|
def self.default_plugin_path
|
39
|
-
[ File.expand_path(File.join(File.dirname(__FILE__),
|
41
|
+
[ File.expand_path(File.join(File.dirname(__FILE__), "plugins")) ]
|
40
42
|
end
|
41
43
|
|
42
44
|
public
|
45
|
+
|
43
46
|
# Copy deprecated configuration options into the ohai config context.
|
44
47
|
def self.merge_deprecated_config
|
45
48
|
[ :hints_path, :plugin_path ].each do |option|
|
@@ -68,7 +71,7 @@ module Ohai
|
|
68
71
|
:disabled_plugins,
|
69
72
|
:log_level,
|
70
73
|
:log_location,
|
71
|
-
:version
|
74
|
+
:version,
|
72
75
|
].each do |option|
|
73
76
|
# https://docs.chef.io/config_rb_client.html#ohai-settings
|
74
77
|
# hints_path and plugin_path are intentionally excluded here; warnings for
|
@@ -100,6 +103,7 @@ module Ohai
|
|
100
103
|
end
|
101
104
|
|
102
105
|
private
|
106
|
+
|
103
107
|
def self.option_deprecated(option)
|
104
108
|
<<-EOM.chomp!.gsub("\n", " ")
|
105
109
|
Ohai::Config[:#{option}] is set. Ohai::Config[:#{option}] is deprecated and will
|
@@ -119,6 +123,6 @@ EOM
|
|
119
123
|
|
120
124
|
# Shortcut for Ohai::Config.ohai
|
121
125
|
def self.config
|
122
|
-
Config
|
126
|
+
Config.ohai
|
123
127
|
end
|
124
128
|
end
|
data/lib/ohai/dsl.rb
CHANGED
data/lib/ohai/dsl/plugin.rb
CHANGED
@@ -18,10 +18,10 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
21
|
+
require "ohai/mixin/os"
|
22
|
+
require "ohai/mixin/command"
|
23
|
+
require "ohai/mixin/seconds_to_human"
|
24
|
+
require "ohai/hints"
|
25
25
|
|
26
26
|
module Ohai
|
27
27
|
|
@@ -171,7 +171,7 @@ module Ohai
|
|
171
171
|
raise e
|
172
172
|
rescue => e
|
173
173
|
Ohai::Log.debug("Plugin #{self.name} threw #{e.inspect}")
|
174
|
-
e.backtrace.each { |line| Ohai::Log.debug( line )}
|
174
|
+
e.backtrace.each { |line| Ohai::Log.debug( line ) }
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
data/lib/ohai/hints.rb
CHANGED
data/lib/ohai/loader.rb
CHANGED
@@ -16,11 +16,11 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
19
|
+
require "chef-config/path_helper"
|
20
|
+
require "ohai/log"
|
21
|
+
require "ohai/mash"
|
22
|
+
require "ohai/dsl"
|
23
|
+
require "pathname"
|
24
24
|
|
25
25
|
module Ohai
|
26
26
|
|
@@ -39,7 +39,7 @@ module Ohai
|
|
39
39
|
|
40
40
|
# Finds all the *.rb files under the configured paths in :plugin_path
|
41
41
|
def self.find_all_in(plugin_dir)
|
42
|
-
Dir[File.join(ChefConfig::PathHelper.
|
42
|
+
Dir[File.join(ChefConfig::PathHelper.escape_glob_dir(plugin_dir), "**", "*.rb")].map do |file|
|
43
43
|
new(file, plugin_dir)
|
44
44
|
end
|
45
45
|
end
|
@@ -95,7 +95,7 @@ module Ohai
|
|
95
95
|
# If `plugin_dir_path` is given, and the file at `plugin_path` is a v6
|
96
96
|
# plugin, the 'relative path' of the plugin (used by `require_plugin()`) is
|
97
97
|
# computed by finding the relative path from `plugin_dir_path` to `plugin_path`
|
98
|
-
def load_plugin_class(plugin_path, plugin_dir_path=nil)
|
98
|
+
def load_plugin_class(plugin_path, plugin_dir_path = nil)
|
99
99
|
# Read the contents of the plugin to understand if it's a V6 or V7 plugin.
|
100
100
|
contents = ""
|
101
101
|
begin
|
data/lib/ohai/log.rb
CHANGED
data/lib/ohai/mash.rb
CHANGED
@@ -128,7 +128,7 @@ class Mash < Hash
|
|
128
128
|
#
|
129
129
|
# @return [Array] The values at each of the provided keys
|
130
130
|
def values_at(*indices)
|
131
|
-
indices.collect {|key| self[convert_key(key)]}
|
131
|
+
indices.collect { |key| self[convert_key(key)] }
|
132
132
|
end
|
133
133
|
|
134
134
|
# @param hash<Hash> The hash to merge with the mash.
|
@@ -152,7 +152,7 @@ class Mash < Hash
|
|
152
152
|
# { :one => 1, :two => 2, :three => 3 }.except(:one)
|
153
153
|
# #=> { "two" => 2, "three" => 3 }
|
154
154
|
def except(*keys)
|
155
|
-
super(*keys.map {|k| convert_key(k)})
|
155
|
+
super(*keys.map { |k| convert_key(k) })
|
156
156
|
end
|
157
157
|
|
158
158
|
# Used to provide the same interface as Hash.
|
@@ -181,6 +181,7 @@ class Mash < Hash
|
|
181
181
|
end
|
182
182
|
|
183
183
|
protected
|
184
|
+
|
184
185
|
# @param key<Object> The key to convert.
|
185
186
|
#
|
186
187
|
# @param [Object]
|