ohai 16.2.3 → 16.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/bin/ohai +0 -2
- data/lib/ohai.rb +1 -1
- data/lib/ohai/application.rb +2 -2
- data/lib/ohai/config.rb +1 -1
- data/lib/ohai/dsl.rb +1 -1
- data/lib/ohai/dsl/plugin.rb +6 -6
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -1
- data/lib/ohai/exception.rb +1 -1
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +2 -3
- data/lib/ohai/log.rb +2 -2
- data/lib/ohai/mixin/azure_metadata.rb +1 -1
- data/lib/ohai/mixin/chef_utils_wiring.rb +39 -0
- data/lib/ohai/mixin/command.rb +3 -54
- data/lib/ohai/mixin/constant_helper.rb +1 -1
- data/lib/ohai/mixin/dmi_decode.rb +3 -3
- data/lib/ohai/mixin/do_metadata.rb +1 -1
- data/lib/ohai/mixin/ec2_metadata.rb +1 -1
- data/lib/ohai/mixin/http_helper.rb +1 -1
- data/lib/ohai/mixin/network_helper.rb +1 -1
- data/lib/ohai/mixin/os.rb +2 -2
- data/lib/ohai/mixin/scaleway_metadata.rb +1 -1
- data/lib/ohai/mixin/seconds_to_human.rb +1 -1
- data/lib/ohai/mixin/shell_out.rb +50 -0
- data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
- data/lib/ohai/mixin/string.rb +1 -1
- data/lib/ohai/mixin/which.rb +38 -0
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/kernel.rb +1 -1
- data/lib/ohai/plugins/aix/memory.rb +4 -4
- data/lib/ohai/plugins/aix/network.rb +3 -2
- data/lib/ohai/plugins/aix/platform.rb +1 -1
- data/lib/ohai/plugins/aix/uptime.rb +2 -2
- data/lib/ohai/plugins/aix/virtualization.rb +6 -6
- data/lib/ohai/plugins/azure.rb +2 -2
- data/lib/ohai/plugins/bsd/virtualization.rb +4 -4
- data/lib/ohai/plugins/c.rb +2 -2
- data/lib/ohai/plugins/cloud.rb +2 -2
- data/lib/ohai/plugins/command.rb +1 -1
- data/lib/ohai/plugins/cpu.rb +4 -4
- data/lib/ohai/plugins/darwin/memory.rb +1 -1
- data/lib/ohai/plugins/darwin/network.rb +4 -4
- data/lib/ohai/plugins/darwin/platform.rb +2 -2
- data/lib/ohai/plugins/darwin/virtualization.rb +2 -2
- data/lib/ohai/plugins/docker.rb +3 -3
- data/lib/ohai/plugins/dragonflybsd/platform.rb +2 -4
- data/lib/ohai/plugins/ec2.rb +9 -8
- data/lib/ohai/plugins/erlang.rb +1 -1
- data/lib/ohai/plugins/eucalyptus.rb +2 -2
- data/lib/ohai/plugins/filesystem.rb +12 -18
- data/lib/ohai/plugins/fips.rb +2 -6
- data/lib/ohai/plugins/freebsd/platform.rb +2 -4
- data/lib/ohai/plugins/gce.rb +3 -3
- data/lib/ohai/plugins/hostname.rb +17 -17
- data/lib/ohai/plugins/init_package.rb +1 -1
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/kernel.rb +3 -3
- data/lib/ohai/plugins/keys.rb +1 -1
- data/lib/ohai/plugins/languages.rb +1 -1
- data/lib/ohai/plugins/libvirt.rb +1 -1
- data/lib/ohai/plugins/linode.rb +1 -1
- data/lib/ohai/plugins/linux/block_device.rb +1 -1
- data/lib/ohai/plugins/linux/hostnamectl.rb +1 -2
- data/lib/ohai/plugins/linux/interrupts.rb +1 -1
- data/lib/ohai/plugins/linux/lsb.rb +2 -3
- data/lib/ohai/plugins/linux/lspci.rb +1 -2
- data/lib/ohai/plugins/linux/machineid.rb +2 -2
- data/lib/ohai/plugins/linux/memory.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +26 -18
- data/lib/ohai/plugins/linux/platform.rb +23 -26
- data/lib/ohai/plugins/linux/virtualization.rb +8 -8
- data/lib/ohai/plugins/netbsd/network.rb +4 -8
- data/lib/ohai/plugins/netbsd/platform.rb +2 -4
- data/lib/ohai/plugins/network.rb +6 -5
- data/lib/ohai/plugins/ohai_time.rb +1 -1
- data/lib/ohai/plugins/openbsd/network.rb +4 -8
- data/lib/ohai/plugins/openbsd/platform.rb +2 -4
- data/lib/ohai/plugins/openstack.rb +4 -3
- data/lib/ohai/plugins/os.rb +1 -1
- data/lib/ohai/plugins/packages.rb +21 -1
- data/lib/ohai/plugins/passwd.rb +2 -1
- data/lib/ohai/plugins/perl.rb +1 -1
- data/lib/ohai/plugins/platform.rb +1 -1
- data/lib/ohai/plugins/powershell.rb +1 -1
- data/lib/ohai/plugins/ps.rb +1 -1
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +5 -4
- data/lib/ohai/plugins/root_group.rb +1 -1
- data/lib/ohai/plugins/ruby.rb +4 -15
- data/lib/ohai/plugins/scaleway.rb +1 -1
- data/lib/ohai/plugins/shard.rb +2 -2
- data/lib/ohai/plugins/shells.rb +1 -1
- data/lib/ohai/plugins/softlayer.rb +1 -1
- data/lib/ohai/plugins/solaris2/dmi.rb +2 -3
- data/lib/ohai/plugins/solaris2/memory.rb +1 -2
- data/lib/ohai/plugins/solaris2/network.rb +8 -14
- data/lib/ohai/plugins/solaris2/platform.rb +2 -3
- data/lib/ohai/plugins/solaris2/virtualization.rb +4 -7
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +2 -2
- data/lib/ohai/plugins/virtualbox.rb +1 -1
- data/lib/ohai/plugins/vmware.rb +3 -3
- data/lib/ohai/plugins/windows/dmi.rb +2 -2
- data/lib/ohai/plugins/windows/drivers.rb +2 -2
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +5 -5
- data/lib/ohai/plugins/windows/platform.rb +2 -2
- data/lib/ohai/plugins/windows/system_enclosure.rb +1 -1
- data/lib/ohai/plugins/windows/virtualization.rb +2 -2
- data/lib/ohai/plugins/zpools.rb +1 -1
- data/lib/ohai/provides_map.rb +3 -3
- data/lib/ohai/runner.rb +2 -2
- data/lib/ohai/system.rb +2 -3
- data/lib/ohai/util/file_helper.rb +4 -37
- data/lib/ohai/util/ip_helper.rb +2 -2
- data/lib/ohai/util/win32.rb +2 -2
- data/lib/ohai/version.rb +2 -2
- data/ohai.gemspec +0 -1
- metadata +5 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8039a80535910fc0746573f29cbd7746fbe1ac34a46a2c98a93603ac7b4fb83e
|
|
4
|
+
data.tar.gz: cf27f4ca401a9c57674d2c10b72867ef1e423d85e3849fcf1cd9d318e87a8716
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54f972aa56f93adfa75ee164c2e505bc1a6b8dcdbc797e6cac6ccc8ea02e5fede2340f63b9529d7f4a3a6ab814543b46d65607c40b39d617602bfad009f183e6
|
|
7
|
+
data.tar.gz: 3453c0ef0e9c0e0dce7eebb258738c1fbcf0578a1894ab6eb7476385b5b0c9973d0dfc2c42be7c9ff544e33838aeeb8979daef1e0f6d331cffca7265643841ec
|
data/Gemfile
CHANGED
|
@@ -5,6 +5,7 @@ gemspec
|
|
|
5
5
|
# NOTE: do not submit PRs to add pry as a dep, add to your Gemfile.local
|
|
6
6
|
group :development do
|
|
7
7
|
gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
|
|
8
|
+
gem "rubocop-performance", "1.8.0"
|
|
8
9
|
gem "rake", ">= 10.1.0"
|
|
9
10
|
gem "rspec-core", "~> 3.0"
|
|
10
11
|
gem "rspec-expectations", "~> 3.0"
|
|
@@ -24,4 +25,4 @@ group :debug do
|
|
|
24
25
|
gem "pry-byebug"
|
|
25
26
|
gem "pry-stack_explorer", "~> 0.4.0" # pin until we drop ruby < 2.6
|
|
26
27
|
gem "rb-readline"
|
|
27
|
-
end
|
|
28
|
+
end
|
data/bin/ohai
CHANGED
data/lib/ohai.rb
CHANGED
data/lib/ohai/application.rb
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
require "chef-config/path_helper"
|
|
19
19
|
require "chef-config/workstation_config_loader"
|
|
20
20
|
require_relative "../ohai"
|
|
21
|
-
require_relative "log"
|
|
21
|
+
require_relative "log" unless defined?(Ohai::Log)
|
|
22
22
|
require "mixlib/cli" unless defined?(Mixlib::CLI)
|
|
23
|
-
require "benchmark"
|
|
23
|
+
require "benchmark" unless defined?(Benchmark)
|
|
24
24
|
|
|
25
25
|
# The Application class is what is called by the Ohai CLI binary. It handles:
|
|
26
26
|
# - CLI options and attribute arguments
|
data/lib/ohai/config.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
|
3
3
|
# Author:: Claire McQuin (<claire@chef.io>)
|
|
4
|
-
# Copyright:: Copyright (c)
|
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
5
5
|
# License:: Apache License, Version 2.0
|
|
6
6
|
#
|
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/ohai/dsl.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Serdar Sutay (<serdar@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/ohai/dsl/plugin.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
|
3
3
|
# Author:: Claire McQuin (<claire@chef.io>)
|
|
4
|
-
# Copyright:: Copyright (c)
|
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
5
5
|
# License:: Apache License, Version 2.0
|
|
6
6
|
#
|
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
#
|
|
20
20
|
|
|
21
21
|
require_relative "../mixin/os"
|
|
22
|
-
require_relative "../mixin/
|
|
22
|
+
require_relative "../mixin/shell_out"
|
|
23
23
|
require_relative "../mixin/seconds_to_human"
|
|
24
|
+
require_relative "../mixin/which"
|
|
24
25
|
require_relative "../hints"
|
|
25
|
-
require_relative "../util/file_helper"
|
|
26
26
|
|
|
27
27
|
module Ohai
|
|
28
28
|
|
|
@@ -65,7 +65,7 @@ module Ohai
|
|
|
65
65
|
#
|
|
66
66
|
# @return [String]
|
|
67
67
|
def self.dev_null
|
|
68
|
-
if RUBY_PLATFORM
|
|
68
|
+
if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
|
|
69
69
|
"NUL"
|
|
70
70
|
else
|
|
71
71
|
"/dev/null"
|
|
@@ -83,9 +83,9 @@ module Ohai
|
|
|
83
83
|
class Plugin
|
|
84
84
|
|
|
85
85
|
include Ohai::Mixin::OS
|
|
86
|
-
include Ohai::Mixin::
|
|
86
|
+
include Ohai::Mixin::ShellOut
|
|
87
87
|
include Ohai::Mixin::SecondsToHuman
|
|
88
|
-
include Ohai::
|
|
88
|
+
include Ohai::Mixin::Which
|
|
89
89
|
|
|
90
90
|
attr_reader :data
|
|
91
91
|
attr_reader :failed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Serdar Sutay (<serdar@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/ohai/exception.rb
CHANGED
data/lib/ohai/hints.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Serdar Sutay (<serdar@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/ohai/loader.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Claire McQuin (<claire@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -71,8 +71,7 @@ module Ohai
|
|
|
71
71
|
from = [ Ohai.config[:plugin_path], from].flatten
|
|
72
72
|
plugin_files_by_dir(from).collect do |plugin_file|
|
|
73
73
|
logger.trace "Loading additional plugin: #{plugin_file}"
|
|
74
|
-
|
|
75
|
-
load_v7_plugin(plugin)
|
|
74
|
+
load_v7_plugin(load_plugin_class(plugin_file))
|
|
76
75
|
end
|
|
77
76
|
end
|
|
78
77
|
|
data/lib/ohai/log.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
#
|
|
18
18
|
|
|
19
|
-
require "mixlib/log"
|
|
19
|
+
require "mixlib/log" unless defined?(Mixlib::Log)
|
|
20
20
|
|
|
21
21
|
module Ohai
|
|
22
22
|
# the Ohai Logger which is just Mixlib::Log defaulting to STDERR and :info level
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
|
+
# License:: Apache License, Version 2.0
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
require_relative "../config"
|
|
19
|
+
|
|
20
|
+
module Ohai
|
|
21
|
+
module Mixin
|
|
22
|
+
# Common Dependency Injection wiring for ChefUtils-related modules
|
|
23
|
+
module ChefUtilsWiring
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def __config
|
|
27
|
+
Ohai::Config
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def __log
|
|
31
|
+
logger
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def __transport_connection
|
|
35
|
+
# Chef.run_context&.transport_connection
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/ohai/mixin/command.rb
CHANGED
|
@@ -1,54 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
|
5
|
-
# License:: Apache License, Version 2.0
|
|
6
|
-
#
|
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
# you may not use this file except in compliance with the License.
|
|
9
|
-
# You may obtain a copy of the License at
|
|
10
|
-
#
|
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
#
|
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
# See the License for the specific language governing permissions and
|
|
17
|
-
# limitations under the License.
|
|
18
|
-
#
|
|
19
|
-
|
|
20
|
-
require_relative "../exception"
|
|
21
|
-
require_relative "../log"
|
|
22
|
-
require "mixlib/shellout" unless defined?(Mixlib::ShellOut::DEFAULT_READ_TIMEOUT)
|
|
23
|
-
|
|
24
|
-
module Ohai
|
|
25
|
-
module Mixin
|
|
26
|
-
module Command
|
|
27
|
-
# DISCLAIMER: Logging only works in the context of a plugin!!
|
|
28
|
-
# accept a command and any of the mixlib-shellout options
|
|
29
|
-
def shell_out(cmd, **options)
|
|
30
|
-
options = options.dup
|
|
31
|
-
# unless specified by the caller timeout after configured timeout (default 30 seconds)
|
|
32
|
-
options[:timeout] ||= Ohai::Config.ohai[:shellout_timeout]
|
|
33
|
-
unless RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
|
34
|
-
options[:env] = options.key?(:env) ? options[:env].dup : {}
|
|
35
|
-
options[:env]["PATH"] ||= ((ENV["PATH"] || "").split(":") + %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}).join(":")
|
|
36
|
-
end
|
|
37
|
-
so = Mixlib::ShellOut.new(cmd, options)
|
|
38
|
-
begin
|
|
39
|
-
so.run_command
|
|
40
|
-
logger.trace("Plugin #{name}: ran '#{cmd}' and returned #{so.exitstatus}")
|
|
41
|
-
so
|
|
42
|
-
rescue Errno::ENOENT => e
|
|
43
|
-
logger.trace("Plugin #{name}: ran '#{cmd}' and failed #{e.inspect}")
|
|
44
|
-
raise Ohai::Exceptions::Exec, e
|
|
45
|
-
rescue Mixlib::ShellOut::CommandTimeout => e
|
|
46
|
-
logger.trace("Plugin #{name}: ran '#{cmd}' and timed out after #{options[:timeout]} seconds")
|
|
47
|
-
raise Ohai::Exceptions::Exec, e
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
module_function :shell_out
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
1
|
+
$stderr.puts "WARN: Ohai::Mixin::Command is deprecated, please use Ohai::Mixin::ShellOut or remove if the reference is unnecessary"
|
|
2
|
+
require_relative "shell_out"
|
|
3
|
+
Ohai::Mixin::Command = Ohai::Mixin::ShellOut unless defined?(Ohai::Mixin::Command)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Serdar Sutay (<serdar@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Tim Smith <tsmith@chef.io>
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -26,7 +26,7 @@ module ::Ohai::Mixin::DmiDecode
|
|
|
26
26
|
when /VMware/
|
|
27
27
|
return "vmware"
|
|
28
28
|
when /Microsoft/
|
|
29
|
-
return "hyperv" if
|
|
29
|
+
return "hyperv" if /Virtual Machine/.match?(product)
|
|
30
30
|
when /Amazon EC2/
|
|
31
31
|
return "amazonec2"
|
|
32
32
|
when /QEMU/
|
|
@@ -40,7 +40,7 @@ module ::Ohai::Mixin::DmiDecode
|
|
|
40
40
|
case product
|
|
41
41
|
when /VirtualBox/
|
|
42
42
|
return "vbox"
|
|
43
|
-
when /OpenStack/ # yes this is here twice. Product catches
|
|
43
|
+
when /OpenStack/ # yes this is here twice. Product catches Red Hat's version
|
|
44
44
|
return "openstack"
|
|
45
45
|
when /(KVM|RHEV)/
|
|
46
46
|
return "kvm"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Author:: Tim Dysinger (<tim@dysinger.net>)
|
|
3
3
|
# Author:: Benjamin Black (<bb@chef.io>)
|
|
4
4
|
# Author:: Christopher Brown (<cb@chef.io>)
|
|
5
|
-
# Copyright::
|
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
6
6
|
# License:: Apache License, Version 2.0
|
|
7
7
|
#
|
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Serdar Sutay (<serdar@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/ohai/mixin/os.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# limitations under the License.
|
|
18
18
|
#
|
|
19
19
|
|
|
20
|
-
require "rbconfig"
|
|
20
|
+
require "rbconfig" unless defined?(RbConfig)
|
|
21
21
|
|
|
22
22
|
module Ohai
|
|
23
23
|
module Mixin
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
|
3
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
5
|
+
# License:: Apache License, Version 2.0
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
require_relative "../exception"
|
|
21
|
+
require_relative "../log"
|
|
22
|
+
|
|
23
|
+
require "mixlib/shellout/helper" unless defined?(Mixlib::ShellOut::Helper)
|
|
24
|
+
require_relative "chef_utils_wiring" unless defined?(Ohai::Mixin::ChefUtilsWiring)
|
|
25
|
+
|
|
26
|
+
module Ohai
|
|
27
|
+
module Mixin
|
|
28
|
+
module ShellOut
|
|
29
|
+
include Mixlib::ShellOut::Helper
|
|
30
|
+
include Ohai::Mixin::ChefUtilsWiring
|
|
31
|
+
|
|
32
|
+
def shell_out(cmd, **options)
|
|
33
|
+
options = options.dup
|
|
34
|
+
# unless specified by the caller timeout after configured timeout (default 30 seconds)
|
|
35
|
+
options[:timeout] ||= Ohai::Config.ohai[:shellout_timeout]
|
|
36
|
+
begin
|
|
37
|
+
so = super(cmd, **options)
|
|
38
|
+
logger.trace("Plugin #{name}: ran '#{cmd}' and returned #{so.exitstatus}")
|
|
39
|
+
so
|
|
40
|
+
rescue Errno::ENOENT => e
|
|
41
|
+
logger.trace("Plugin #{name}: ran '#{cmd}' and failed #{e.inspect}")
|
|
42
|
+
raise Ohai::Exceptions::Exec, e
|
|
43
|
+
rescue Mixlib::ShellOut::CommandTimeout => e
|
|
44
|
+
logger.trace("Plugin #{name}: ran '#{cmd}' and timed out after #{options[:timeout]} seconds")
|
|
45
|
+
raise Ohai::Exceptions::Exec, e
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|