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 +1 -1
- data/lib/ohai.rb +1 -1
- data/lib/ohai/config.rb +1 -0
- data/lib/ohai/plugins/linux/virtualization.rb +1 -1
- data/lib/ohai/plugins/solaris2/network.rb +1 -1
- data/lib/ohai/system.rb +8 -0
- data/spec/ohai/plugins/linux/virtualization_spec.rb +2 -2
- data/spec/ohai/plugins/solaris2/network_spec.rb +1 -1
- data/spec/ohai/system_spec.rb +6 -0
- metadata +3 -3
data/Rakefile
CHANGED
data/lib/ohai.rb
CHANGED
data/lib/ohai/config.rb
CHANGED
@@ -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.
|
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.
|
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}")
|
data/lib/ohai/system.rb
CHANGED
@@ -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!(:
|
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!(:
|
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`", :
|
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
|
data/spec/ohai/system_spec.rb
CHANGED
@@ -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
|
-
-
|
7
|
+
- 5
|
8
8
|
- 0
|
9
|
-
version: 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-
|
17
|
+
date: 2010-03-04 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|