ohai 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'date'
5
5
  require 'spec/rake/spectask'
6
6
 
7
7
  GEM = "ohai"
8
- GEM_VERSION = "0.4.0"
8
+ GEM_VERSION = "0.5.0"
9
9
  AUTHOR = "Adam Jacob"
10
10
  EMAIL = "adam@opscode.com"
11
11
  HOMEPAGE = "http://wiki.opscode.com/display/ohai"
@@ -23,5 +23,5 @@ require 'ohai/config'
23
23
  require 'ohai/system'
24
24
 
25
25
  module Ohai
26
- VERSION = '0.4.0'
26
+ VERSION = '0.5.0'
27
27
  end
@@ -25,5 +25,6 @@ module Ohai
25
25
  log_level :info
26
26
  log_location STDOUT
27
27
  plugin_path [ File.expand_path(File.join(File.dirname(__FILE__), 'plugins'))]
28
+ disabled_plugins []
28
29
  end
29
30
  end
@@ -54,7 +54,7 @@ end
54
54
  if File.exists?("/usr/sbin/dmidecode")
55
55
  popen4("dmidecode") do |pid, stdin, stdout, stderr|
56
56
  stdin.close
57
- dmi_info = stdout.string
57
+ dmi_info = stdout.read
58
58
  case dmi_info
59
59
  when /Manufacturer: Microsoft/
60
60
  if dmi_info =~ /Product Name: Virtual Machine/
@@ -144,7 +144,7 @@ network[:interfaces] = iface
144
144
 
145
145
  popen4("route get default") do |pid, stdin, stdout, stderr|
146
146
  stdin.close
147
- route_get = stdout.string
147
+ route_get = stdout.read
148
148
  matches = /interface: (\S+)/.match(route_get)
149
149
  if matches
150
150
  Ohai::Log.debug("found gateway device: #{$1}")
@@ -128,6 +128,9 @@ module Ohai
128
128
  end
129
129
  end
130
130
  end
131
+ # Catch any errant children who need to be reaped
132
+ Process.waitall
133
+ true
131
134
  end
132
135
 
133
136
  def collect_providers(providers)
@@ -175,6 +178,11 @@ module Ohai
175
178
  return true if @seen_plugins[plugin_name]
176
179
  end
177
180
 
181
+ if Ohai::Config[:disabled_plugins].include?(plugin_name)
182
+ Ohai::Log.debug("Skipping disabled plugin #{plugin_name}")
183
+ return false
184
+ end
185
+
178
186
  @plugin_path = plugin_name
179
187
 
180
188
  filename = "#{plugin_name.gsub("::", File::SEPARATOR)}.rb"
@@ -105,7 +105,7 @@ System Information
105
105
  UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
106
106
  Wake-up Type: Power Switch
107
107
  MSVPC
108
- @stdout.stub!(:string).and_return(ms_vpc_dmidecode)
108
+ @stdout.stub!(:read).and_return(ms_vpc_dmidecode)
109
109
 
110
110
  @ohai.stub!(:popen4).with("dmidecode").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
111
111
  @ohai._require_plugin("linux::virtualization")
@@ -125,7 +125,7 @@ System Information
125
125
  SKU Number: Not Specified
126
126
  Family: Not Specified
127
127
  VMWARE
128
- @stdout.stub!(:string).and_return(vmware_dmidecode)
128
+ @stdout.stub!(:read).and_return(vmware_dmidecode)
129
129
  @ohai.stub!(:popen4).with("dmidecode").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
130
130
  @ohai._require_plugin("linux::virtualization")
131
131
  @ohai[:virtualization][:emulator].should == "vmware"
@@ -122,7 +122,7 @@ ROUTE_GET
122
122
 
123
123
  describe "setting the node's default IP address attribute" do
124
124
  before do
125
- @stdout = mock("Pipe, stdout, cmd=`route get default`", :string => @solaris_route_get)
125
+ @stdout = mock("Pipe, stdout, cmd=`route get default`", :read => @solaris_route_get)
126
126
  @ohai.stub!(:popen4).with("route get default").and_yield(nil,@stdin, @stdout, nil)
127
127
  @ohai._require_plugin("solaris2::network")
128
128
  end
@@ -126,5 +126,11 @@ describe Ohai::System, "require_plugin" do
126
126
  it "should return true if the plugin has been loaded" do
127
127
  @ohai.require_plugin("foo").should eql(true)
128
128
  end
129
+
130
+ it "should return false if the plugin is in the disabled plugins list" do
131
+ Ohai::Config[:disabled_plugins] = [ "foo" ]
132
+ Ohai::Log.should_receive(:debug).with("Skipping disabled plugin foo")
133
+ @ohai.require_plugin("foo").should eql(false)
134
+ end
129
135
  end
130
136
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
7
+ - 5
8
8
  - 0
9
- version: 0.4.0
9
+ version: 0.5.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Adam Jacob
@@ -14,7 +14,7 @@ autorequire: ohai
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-02-28 00:00:00 -08:00
17
+ date: 2010-03-04 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency