ohai 13.4.0 → 13.5.0

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
  SHA1:
3
- metadata.gz: 65368dc9cbcaede4fadbcbf469c90fb68a64b4c0
4
- data.tar.gz: 6c5a528d552e9cf11a81f6b5181ad86f226ff6cc
3
+ metadata.gz: e65f269d28a4e10d57a696348f63e3ab208e6d55
4
+ data.tar.gz: 75ed053be1baa6c94abe967f350d8e5469f68a91
5
5
  SHA512:
6
- metadata.gz: 8b4557d434f813f5b4320274d48a14791a5bd6111c2163ffbc7934efe68d43a71d64d067196da68ca31895dd0947d0e021b80e936a9216e3a01bd398f6d80208
7
- data.tar.gz: 848d151c7ff1b30b15971d9d4b7d2e9a34f239f9f256df3f7cc1324b39cb811bf7245f1e15ce39e7ede589f30e3412e4093f27043bd0e4b02da2aa39262ca2dd
6
+ metadata.gz: 6240f2a183fef7382c07416c887595d6855ff5210c453acbde845b3fb240f8efdbf3a8c41c8e51c39b887a744a34d9d7fe6b8511a9a45697e29fbf60da8957ca
7
+ data.tar.gz: 56e191347c743a0070b0f82e9f4f99928e954c9376d1778ddfbc4952271972645782fd6ee1b09e0f075e6e1c4233c18450a24e02979923a899e86af6cc182ab5
@@ -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
- configure_ohai
78
- run_application
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
@@ -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
- # require "wmi-lite/wmi"
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
- route_entry[k] = $1 if route_ending =~ /\b#{k}\s+([^\s]+)\b/
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:
@@ -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
- unless plugin.kind_of?(Ohai::DSL::Plugin)
37
- raise Ohai::Exceptions::InvalidPlugin, "Invalid plugin #{plugin} (must be an Ohai::DSL::Plugin or subclass)"
38
- end
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
- begin
41
- case plugin.version
42
- when :version7
43
- run_v7_plugin(plugin)
44
- when :version6
45
- run_v6_plugin(plugin)
46
- else
47
- raise Ohai::Exceptions::InvalidPlugin, "Invalid plugin version #{plugin.version} for plugin #{plugin}"
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)
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = "13.4.0"
21
+ VERSION = "13.5.0"
22
22
  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: 13.4.0
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 00:00:00.000000000 Z
11
+ date: 2017-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu