ohai 13.4.0 → 13.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/lib/ohai/application.rb +6 -2
- data/lib/ohai/plugins/ec2.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +2 -1
- data/lib/ohai/runner.rb +21 -17
- data/lib/ohai/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e65f269d28a4e10d57a696348f63e3ab208e6d55
|
4
|
+
data.tar.gz: 75ed053be1baa6c94abe967f350d8e5469f68a91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6240f2a183fef7382c07416c887595d6855ff5210c453acbde845b3fb240f8efdbf3a8c41c8e51c39b887a744a34d9d7fe6b8511a9a45697e29fbf60da8957ca
|
7
|
+
data.tar.gz: 56e191347c743a0070b0f82e9f4f99928e954c9376d1778ddfbc4952271972645782fd6ee1b09e0f075e6e1c4233c18450a24e02979923a899e86af6cc182ab5
|
data/lib/ohai/application.rb
CHANGED
@@ -20,6 +20,7 @@ require "chef-config/workstation_config_loader"
|
|
20
20
|
require "ohai"
|
21
21
|
require "ohai/log"
|
22
22
|
require "mixlib/cli"
|
23
|
+
require "benchmark"
|
23
24
|
|
24
25
|
class Ohai::Application
|
25
26
|
include Mixlib::CLI
|
@@ -74,8 +75,11 @@ class Ohai::Application
|
|
74
75
|
end
|
75
76
|
|
76
77
|
def run
|
77
|
-
|
78
|
-
|
78
|
+
elapsed = Benchmark.measure do
|
79
|
+
configure_ohai
|
80
|
+
run_application
|
81
|
+
end
|
82
|
+
Ohai::Log.debug("Ohai took #{elapsed.total} total seconds to run.")
|
79
83
|
end
|
80
84
|
|
81
85
|
def configure_ohai
|
data/lib/ohai/plugins/ec2.rb
CHANGED
@@ -70,7 +70,7 @@ Ohai.plugin(:EC2) do
|
|
70
70
|
# @return [Boolean] do we have a Xen Identifying Number or not?
|
71
71
|
def has_ec2_identifying_number?
|
72
72
|
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
73
|
-
|
73
|
+
require "wmi-lite/wmi"
|
74
74
|
wmi = WmiLite::Wmi.new
|
75
75
|
if wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"] =~ /^ec2/
|
76
76
|
Ohai::Log.debug("Plugin EC2: has_ec2_identifying_number? == true")
|
@@ -104,7 +104,8 @@ Ohai.plugin(:Network) do
|
|
104
104
|
route_entry = Mash.new(:destination => route_dest,
|
105
105
|
:family => family[:name])
|
106
106
|
%w{via scope metric proto src}.each do |k|
|
107
|
-
|
107
|
+
# http://rubular.com/r/pwTNp65VFf
|
108
|
+
route_entry[k] = $1 if route_ending =~ /\b#{k}\s+([^\s]+)/
|
108
109
|
end
|
109
110
|
|
110
111
|
# a sanity check, especially for Linux-VServer, OpenVZ and LXC:
|
data/lib/ohai/runner.rb
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
#
|
19
19
|
|
20
20
|
require "ohai/dsl"
|
21
|
+
require "benchmark"
|
21
22
|
|
22
23
|
module Ohai
|
23
24
|
class Runner
|
@@ -33,26 +34,29 @@ module Ohai
|
|
33
34
|
# If force is set to true, then this plugin and its dependencies
|
34
35
|
# will be run even if they have been run before.
|
35
36
|
def run_plugin(plugin)
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
elapsed = Benchmark.measure do
|
38
|
+
unless plugin.kind_of?(Ohai::DSL::Plugin)
|
39
|
+
raise Ohai::Exceptions::InvalidPlugin, "Invalid plugin #{plugin} (must be an Ohai::DSL::Plugin or subclass)"
|
40
|
+
end
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
begin
|
43
|
+
case plugin.version
|
44
|
+
when :version7
|
45
|
+
run_v7_plugin(plugin)
|
46
|
+
when :version6
|
47
|
+
run_v6_plugin(plugin)
|
48
|
+
else
|
49
|
+
raise Ohai::Exceptions::InvalidPlugin, "Invalid plugin version #{plugin.version} for plugin #{plugin}"
|
50
|
+
end
|
51
|
+
rescue Ohai::Exceptions::Error
|
52
|
+
raise
|
53
|
+
rescue SystemExit # abort or exit from plug-in should exit Ohai with failure code
|
54
|
+
raise
|
55
|
+
rescue Exception, Errno::ENOENT => e
|
56
|
+
Ohai::Log.debug("Plugin #{plugin.name} threw exception #{e.inspect} #{e.backtrace.join("\n")}")
|
48
57
|
end
|
49
|
-
rescue Ohai::Exceptions::Error
|
50
|
-
raise
|
51
|
-
rescue SystemExit # abort or exit from plug-in should exit Ohai with failure code
|
52
|
-
raise
|
53
|
-
rescue Exception, Errno::ENOENT => e
|
54
|
-
Ohai::Log.debug("Plugin #{plugin.name} threw exception #{e.inspect} #{e.backtrace.join("\n")}")
|
55
58
|
end
|
59
|
+
Ohai::Log.debug("Plugin #{plugin.name} took #{elapsed.total} seconds to run.")
|
56
60
|
end
|
57
61
|
|
58
62
|
def run_v6_plugin(plugin)
|
data/lib/ohai/version.rb
CHANGED
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: 13.
|
4
|
+
version: 13.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|