summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ohai/dsl/plugin.rb9
-rw-r--r--lib/ohai/system.rb10
-rw-r--r--spec/ohai/dsl/plugin_spec.rb2
-rw-r--r--spec/unit/plugins/azure_spec.rb2
-rw-r--r--spec/unit/plugins/c_spec.rb2
-rw-r--r--spec/unit/plugins/chef_spec.rb2
-rw-r--r--spec/unit/plugins/cloud_spec.rb2
-rw-r--r--spec/unit/plugins/darwin/cpu_spec.rb2
-rw-r--r--spec/unit/plugins/darwin/hostname_spec.rb2
-rw-r--r--spec/unit/plugins/darwin/kernel_spec.rb2
-rw-r--r--spec/unit/plugins/darwin/network_spec.rb2
-rw-r--r--spec/unit/plugins/darwin/platform_spec.rb2
-rw-r--r--spec/unit/plugins/darwin/system_profiler_spec.rb2
-rw-r--r--spec/unit/plugins/dmi_spec.rb2
-rw-r--r--spec/unit/plugins/ec2_spec.rb2
-rw-r--r--spec/unit/plugins/erlang_spec.rb2
-rw-r--r--spec/unit/plugins/eucalyptus_spec.rb2
-rw-r--r--spec/unit/plugins/freebsd/hostname_spec.rb2
-rw-r--r--spec/unit/plugins/freebsd/kernel_spec.rb2
-rw-r--r--spec/unit/plugins/freebsd/platform_spec.rb2
-rw-r--r--spec/unit/plugins/freebsd/virtualization_spec.rb2
-rw-r--r--spec/unit/plugins/gce_spec.rb2
-rw-r--r--spec/unit/plugins/groovy_spec.rb2
-rw-r--r--spec/unit/plugins/hostname_spec.rb2
-rw-r--r--spec/unit/plugins/java_spec.rb4
-rw-r--r--spec/unit/plugins/kernel_spec.rb2
-rw-r--r--spec/unit/plugins/linode_spec.rb2
-rw-r--r--spec/unit/plugins/linux/cpu_spec.rb4
-rw-r--r--spec/unit/plugins/linux/filesystem_spec.rb2
-rw-r--r--spec/unit/plugins/linux/hostname_spec.rb4
-rw-r--r--spec/unit/plugins/linux/kernel_spec.rb2
-rw-r--r--spec/unit/plugins/linux/lsb_spec.rb2
-rw-r--r--spec/unit/plugins/linux/network_spec.rb2
-rw-r--r--spec/unit/plugins/linux/platform_spec.rb2
-rw-r--r--spec/unit/plugins/linux/uptime_spec.rb4
-rw-r--r--spec/unit/plugins/linux/virtualization_spec.rb2
-rw-r--r--spec/unit/plugins/lua_spec.rb2
-rw-r--r--spec/unit/plugins/mono_spec.rb2
-rw-r--r--spec/unit/plugins/netbsd/hostname_spec.rb2
-rw-r--r--spec/unit/plugins/netbsd/kernel_spec.rb2
-rw-r--r--spec/unit/plugins/netbsd/platform_spec.rb2
-rw-r--r--spec/unit/plugins/network_spec.rb2
-rw-r--r--spec/unit/plugins/nodejs_spec.rb2
-rw-r--r--spec/unit/plugins/ohai_spec.rb2
-rw-r--r--spec/unit/plugins/ohai_time_spec.rb4
-rw-r--r--spec/unit/plugins/openbsd/hostname_spec.rb2
-rw-r--r--spec/unit/plugins/openbsd/kernel_spec.rb2
-rw-r--r--spec/unit/plugins/openbsd/platform_spec.rb2
-rw-r--r--spec/unit/plugins/os_spec.rb4
-rw-r--r--spec/unit/plugins/passwd_spec.rb2
-rw-r--r--spec/unit/plugins/perl_spec.rb2
-rw-r--r--spec/unit/plugins/php_spec.rb2
-rw-r--r--spec/unit/plugins/platform_spec.rb4
-rw-r--r--spec/unit/plugins/python_spec.rb2
-rw-r--r--spec/unit/plugins/rackspace_spec.rb2
-rw-r--r--spec/unit/plugins/root_group_spec.rb2
-rw-r--r--spec/unit/plugins/ruby_spec.rb2
-rw-r--r--spec/unit/plugins/sigar/network_route_spec.rb2
-rw-r--r--spec/unit/plugins/solaris2/hostname_spec.rb4
-rw-r--r--spec/unit/plugins/solaris2/kernel_spec.rb2
-rw-r--r--spec/unit/plugins/solaris2/network_spec.rb2
-rw-r--r--spec/unit/plugins/solaris2/platform_spec.rb2
-rw-r--r--spec/unit/plugins/solaris2/virtualization_spec.rb2
-rw-r--r--spec/unit/plugins/ssh_host_keys_spec.rb2
-rw-r--r--spec/unit/system_spec.rb25
65 files changed, 105 insertions, 79 deletions
diff --git a/lib/ohai/dsl/plugin.rb b/lib/ohai/dsl/plugin.rb
index edc02af5..ae09b36b 100644
--- a/lib/ohai/dsl/plugin.rb
+++ b/lib/ohai/dsl/plugin.rb
@@ -13,11 +13,12 @@ module Ohai
attr_reader :file
attr_reader :data
- def initialize(controller, file)
+ def initialize(controller, name, file)
@controller = controller
@data = controller.data
- @providers = controller.providers
+ @metadata = controller.metadata
@file = file
+ @name = name
end
def run
@@ -63,7 +64,7 @@ module Ohai
def provides(*paths)
paths.each do |path|
parts = path.split('/')
- h = @providers
+ h = @metadata
unless parts.length == 0
parts.shift if parts[0].length == 0
parts.each do |part|
@@ -73,6 +74,8 @@ module Ohai
end
h[:_providers] ||= []
h[:_providers] << @file
+ h[:_plugin_name] ||= []
+ h[:_plugin_name] << @name
end
end
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb
index 8e5e212a..c632170b 100644
--- a/lib/ohai/system.rb
+++ b/lib/ohai/system.rb
@@ -31,12 +31,12 @@ module Ohai
attr_accessor :data
attr_reader :seen_plugins
attr_reader :hints
- attr_reader :providers
+ attr_reader :metadata
def initialize
@data = Mash.new
@seen_plugins = Hash.new
- @providers = Mash.new
+ @metadata = Mash.new
@plugin_path = ""
@hints = Hash.new
end
@@ -90,10 +90,10 @@ module Ohai
def refresh_plugins(path = '/')
parts = path.split('/')
if parts.length == 0
- h = @providers
+ h = @metadata
else
parts.shift if parts[0].length == 0
- h = @providers
+ h = @metadata
parts.each do |part|
break unless h.has_key?(part)
h = h[part]
@@ -147,7 +147,7 @@ module Ohai
Ohai::Config[:plugin_path].each do |path|
check_path = File.expand_path(File.join(path, filename))
if File.exist?(check_path)
- plugin = DSL::Plugin.new(self, check_path)
+ plugin = DSL::Plugin.new(self, filename.split('.')[0], check_path)
break
else
next
diff --git a/spec/ohai/dsl/plugin_spec.rb b/spec/ohai/dsl/plugin_spec.rb
index d0c30747..bda341c0 100644
--- a/spec/ohai/dsl/plugin_spec.rb
+++ b/spec/ohai/dsl/plugin_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path("../../../spec_helper", __FILE__)
describe Ohai::DSL::Plugin do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, "")
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "", "")
end
describe "when accessing data via method_missing" do
diff --git a/spec/unit/plugins/azure_spec.rb b/spec/unit/plugins/azure_spec.rb
index 30bc8cba..508009ca 100644
--- a/spec/unit/plugins/azure_spec.rb
+++ b/spec/unit/plugins/azure_spec.rb
@@ -23,7 +23,7 @@ require 'open-uri'
describe Ohai::System, "plugin azure" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("azure.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "azure", File.expand_path("azure.rb", PLUGIN_PATH))
end
describe "with azure cloud file" do
diff --git a/spec/unit/plugins/c_spec.rb b/spec/unit/plugins/c_spec.rb
index a9d7dba0..3289f7e7 100644
--- a/spec/unit/plugins/c_spec.rb
+++ b/spec/unit/plugins/c_spec.rb
@@ -105,7 +105,7 @@ describe Ohai::System, "plugin c" do
before(:each) do
@ohai = Ohai::System.new
@path = File.join(PLUGIN_PATH, "c.rb")
- @plugin = Ohai::DSL::Plugin.new(@ohai, @path)
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "c", @path)
@plugin[:languages] = Mash.new
diff --git a/spec/unit/plugins/chef_spec.rb b/spec/unit/plugins/chef_spec.rb
index 1f402e6f..82f9c83f 100644
--- a/spec/unit/plugins/chef_spec.rb
+++ b/spec/unit/plugins/chef_spec.rb
@@ -26,7 +26,7 @@ begin
describe Ohai::System, "plugin chef" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "chef.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "chef", File.join(PLUGIN_PATH, "chef.rb"))
end
it "should set [:chef_packages][:chef][:version] to the current chef version", :if => defined?(Chef) do
diff --git a/spec/unit/plugins/cloud_spec.rb b/spec/unit/plugins/cloud_spec.rb
index 07e14b0e..63e94112 100644
--- a/spec/unit/plugins/cloud_spec.rb
+++ b/spec/unit/plugins/cloud_spec.rb
@@ -20,7 +20,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "plugin cloud" do
before do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("cloud.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "cloud", File.expand_path("cloud.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin)
end
diff --git a/spec/unit/plugins/darwin/cpu_spec.rb b/spec/unit/plugins/darwin/cpu_spec.rb
index dd94b144..70c9db41 100644
--- a/spec/unit/plugins/darwin/cpu_spec.rb
+++ b/spec/unit/plugins/darwin/cpu_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Darwin cpu plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("darwin/cpu.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "darwin/cpu", File.expand_path("darwin/cpu.rb", PLUGIN_PATH))
@plugin.stub(:from).with("sysctl -n hw.physicalcpu").and_return("1")
@plugin.stub(:from).with("sysctl -n hw.logicalcpu").and_return("2")
end
diff --git a/spec/unit/plugins/darwin/hostname_spec.rb b/spec/unit/plugins/darwin/hostname_spec.rb
index f3d9e4f9..d64a3d67 100644
--- a/spec/unit/plugins/darwin/hostname_spec.rb
+++ b/spec/unit/plugins/darwin/hostname_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Darwin hostname plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("darwin/hostname.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "darwin/hostname", File.expand_path("darwin/hostname.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = "darwin"
@plugin.stub(:from).with("hostname -s").and_return("katie")
diff --git a/spec/unit/plugins/darwin/kernel_spec.rb b/spec/unit/plugins/darwin/kernel_spec.rb
index 694c9488..b8314817 100644
--- a/spec/unit/plugins/darwin/kernel_spec.rb
+++ b/spec/unit/plugins/darwin/kernel_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Darwin kernel plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("darwin/kernel.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "darwin/kernel", File.expand_path("darwin/kernel.rb", PLUGIN_PATH))
@plugin[:kernel] = Mash.new
@plugin[:kernel][:name] = "darwin"
@plugin.should_receive(:popen4).with("kextstat -k -l").and_yield(1, StringIO.new, StringIO.new, StringIO.new)
diff --git a/spec/unit/plugins/darwin/network_spec.rb b/spec/unit/plugins/darwin/network_spec.rb
index 26371ba2..40d26814 100644
--- a/spec/unit/plugins/darwin/network_spec.rb
+++ b/spec/unit/plugins/darwin/network_spec.rb
@@ -413,7 +413,7 @@ net.smb.fs.tcprcvbuf: 261120
DARWIN_SYSCTL
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("darwin/network.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "darwin/network", File.expand_path("darwin/network.rb", PLUGIN_PATH))
@stdin_ifconfig = StringIO.new
@stdin_arp = StringIO.new
diff --git a/spec/unit/plugins/darwin/platform_spec.rb b/spec/unit/plugins/darwin/platform_spec.rb
index f98b4cf5..bf685ebd 100644
--- a/spec/unit/plugins/darwin/platform_spec.rb
+++ b/spec/unit/plugins/darwin/platform_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Darwin plugin platform" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("darwin/platform.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "darwin/platform", File.expand_path("darwin/platform.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = "darwin"
@pid = 10
diff --git a/spec/unit/plugins/darwin/system_profiler_spec.rb b/spec/unit/plugins/darwin/system_profiler_spec.rb
index fae624bb..4f936f59 100644
--- a/spec/unit/plugins/darwin/system_profiler_spec.rb
+++ b/spec/unit/plugins/darwin/system_profiler_spec.rb
@@ -29,7 +29,7 @@ end
describe Ohai::System, "Darwin system_profiler plugin", :unix_only do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("darwin/system_profiler.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "darwin/system_profiler", File.expand_path("darwin/system_profiler.rb", PLUGIN_PATH))
end
it "should return the right serial number" do
diff --git a/spec/unit/plugins/dmi_spec.rb b/spec/unit/plugins/dmi_spec.rb
index 8f233d72..3e251ac7 100644
--- a/spec/unit/plugins/dmi_spec.rb
+++ b/spec/unit/plugins/dmi_spec.rb
@@ -94,7 +94,7 @@ EOS
describe Ohai::System, "plugin dmi" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "dmi.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "dmi", File.join(PLUGIN_PATH, "dmi.rb"))
@plugin.stub(:require_plugin).and_return(true)
@stdin = double("STDIN", { :close => true })
@pid = 10
diff --git a/spec/unit/plugins/ec2_spec.rb b/spec/unit/plugins/ec2_spec.rb
index ae018f0e..fc2a855f 100644
--- a/spec/unit/plugins/ec2_spec.rb
+++ b/spec/unit/plugins/ec2_spec.rb
@@ -23,7 +23,7 @@ require 'open-uri'
describe Ohai::System, "plugin ec2" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "ec2.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "ec2", File.join(PLUGIN_PATH, "ec2.rb"))
@plugin.stub(:require_plugin)
@plugin[:network] = {:interfaces => {:eth0 => {} } }
end
diff --git a/spec/unit/plugins/erlang_spec.rb b/spec/unit/plugins/erlang_spec.rb
index 7f1b2f00..5511244f 100644
--- a/spec/unit/plugins/erlang_spec.rb
+++ b/spec/unit/plugins/erlang_spec.rb
@@ -23,7 +23,7 @@ describe Ohai::System, "plugin erlang" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "erlang.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "erlang", File.join(PLUGIN_PATH, "erlang.rb"))
@plugin[:languages] = Mash.new
@status = 0
@stdin = ""
diff --git a/spec/unit/plugins/eucalyptus_spec.rb b/spec/unit/plugins/eucalyptus_spec.rb
index 310f0990..27c583f5 100644
--- a/spec/unit/plugins/eucalyptus_spec.rb
+++ b/spec/unit/plugins/eucalyptus_spec.rb
@@ -23,7 +23,7 @@ require 'open-uri'
describe Ohai::System, "plugin eucalyptus" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "eucalyptus.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "eucalyptus", File.join(PLUGIN_PATH, "eucalyptus.rb"))
@plugin.stub(:require_plugin).and_return(true)
end
diff --git a/spec/unit/plugins/freebsd/hostname_spec.rb b/spec/unit/plugins/freebsd/hostname_spec.rb
index c4b74f81..f23cdd6a 100644
--- a/spec/unit/plugins/freebsd/hostname_spec.rb
+++ b/spec/unit/plugins/freebsd/hostname_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "FreeBSD hostname plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("freebsd/hostname.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "freebsd/hostname", File.expand_path("freebsd/hostname.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = "freebsd"
@plugin.stub(:from).with("hostname -s").and_return("katie")
diff --git a/spec/unit/plugins/freebsd/kernel_spec.rb b/spec/unit/plugins/freebsd/kernel_spec.rb
index 8f660d5f..10362b86 100644
--- a/spec/unit/plugins/freebsd/kernel_spec.rb
+++ b/spec/unit/plugins/freebsd/kernel_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "FreeBSD kernel plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("freebsd/kernel.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "freebsd/kernel", File.expand_path("freebsd/kernel.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin.stub(:from).with("uname -i").and_return("foo")
@plugin.stub(:from_with_regex).with("sysctl kern.securelevel", /kern.securelevel: (.+)$/).and_return("kern.securelevel: 1")
diff --git a/spec/unit/plugins/freebsd/platform_spec.rb b/spec/unit/plugins/freebsd/platform_spec.rb
index 80cbbb3d..60f3ee1b 100644
--- a/spec/unit/plugins/freebsd/platform_spec.rb
+++ b/spec/unit/plugins/freebsd/platform_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "FreeBSD plugin platform" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("freebsd/platform.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "freebsd/platform", File.expand_path("freebsd/platform.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin.stub(:from).with("uname -s").and_return("FreeBSD")
@plugin.stub(:from).with("uname -r").and_return("7.1")
diff --git a/spec/unit/plugins/freebsd/virtualization_spec.rb b/spec/unit/plugins/freebsd/virtualization_spec.rb
index 53fb9ada..2a4a8670 100644
--- a/spec/unit/plugins/freebsd/virtualization_spec.rb
+++ b/spec/unit/plugins/freebsd/virtualization_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "FreeBSD virtualization plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "freebsd/virtualization.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "freebsd/virtualization", File.join(PLUGIN_PATH, "freebsd/virtualization.rb"))
@plugin.stub(:require_plugin)
@plugin[:os] = "freebsd"
@stderr = StringIO.new
diff --git a/spec/unit/plugins/gce_spec.rb b/spec/unit/plugins/gce_spec.rb
index 64eb58ec..c8de459e 100644
--- a/spec/unit/plugins/gce_spec.rb
+++ b/spec/unit/plugins/gce_spec.rb
@@ -21,7 +21,7 @@ require 'open-uri'
describe Ohai::System, "plugin gce" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "gce.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "gce", File.join(PLUGIN_PATH, "gce.rb"))
@plugin.stub(:require_plugin)
end
diff --git a/spec/unit/plugins/groovy_spec.rb b/spec/unit/plugins/groovy_spec.rb
index 02ff0e65..78320835 100644
--- a/spec/unit/plugins/groovy_spec.rb
+++ b/spec/unit/plugins/groovy_spec.rb
@@ -23,7 +23,7 @@ describe Ohai::System, "plugin groovy" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "groovy.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "groovy", File.join(PLUGIN_PATH, "groovy.rb"))
@plugin[:languages] = Mash.new
@plugin.stub(:require_plugin).and_return(true)
@status = 0
diff --git a/spec/unit/plugins/hostname_spec.rb b/spec/unit/plugins/hostname_spec.rb
index 2098fead..7af18b86 100644
--- a/spec/unit/plugins/hostname_spec.rb
+++ b/spec/unit/plugins/hostname_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "hostname plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "hostname.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "hostname", File.join(PLUGIN_PATH, "hostname.rb"))
@plugin.stub(:require_plugin).and_return(true)
end
diff --git a/spec/unit/plugins/java_spec.rb b/spec/unit/plugins/java_spec.rb
index 1f4a9913..ae89b913 100644
--- a/spec/unit/plugins/java_spec.rb
+++ b/spec/unit/plugins/java_spec.rb
@@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "plugin java (Java5 Client VM)" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "java.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "java", File.join(PLUGIN_PATH, "java.rb"))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:languages] = Mash.new
@status = 0
@@ -73,7 +73,7 @@ end
describe Ohai::System, "plugin java (Java6 Server VM)" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "java.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "java", File.join(PLUGIN_PATH, "java.rb"))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:languages] = Mash.new
@status = 0
diff --git a/spec/unit/plugins/kernel_spec.rb b/spec/unit/plugins/kernel_spec.rb
index fe85c5cc..60fcfe47 100644
--- a/spec/unit/plugins/kernel_spec.rb
+++ b/spec/unit/plugins/kernel_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "plugin kernel" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "kernel.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "kernel", File.join(PLUGIN_PATH, "kernel.rb"))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:languages] = Mash.new
diff --git a/spec/unit/plugins/linode_spec.rb b/spec/unit/plugins/linode_spec.rb
index 00c6bbf5..ba815092 100644
--- a/spec/unit/plugins/linode_spec.rb
+++ b/spec/unit/plugins/linode_spec.rb
@@ -23,7 +23,7 @@ describe Ohai::System, "plugin linode" do
before do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "linode.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linode", File.join(PLUGIN_PATH, "linode.rb"))
@plugin.stub(:require_plugin)
@plugin[:network] = {
"interfaces"=> {
diff --git a/spec/unit/plugins/linux/cpu_spec.rb b/spec/unit/plugins/linux/cpu_spec.rb
index 74a6d60a..ac238b66 100644
--- a/spec/unit/plugins/linux/cpu_spec.rb
+++ b/spec/unit/plugins/linux/cpu_spec.rb
@@ -21,8 +21,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Linux cpu plugin" do
before(:each) do
- @ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("linux/cpu.rb", PLUGIN_PATH))
+ @ohai = Ohai::System.new
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linux/cpu", File.expand_path("linux/cpu.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = "linux"
@double_file = double("/proc/cpuinfo")
diff --git a/spec/unit/plugins/linux/filesystem_spec.rb b/spec/unit/plugins/linux/filesystem_spec.rb
index e424174a..6d7ab9f4 100644
--- a/spec/unit/plugins/linux/filesystem_spec.rb
+++ b/spec/unit/plugins/linux/filesystem_spec.rb
@@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Linux filesystem plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("linux/filesystem.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linux/filesystem", File.expand_path("linux/filesystem.rb", PLUGIN_PATH))
@plugin[:os] = "linux"
@plugin.stub(:require_plugin).and_return(true)
@plugin.extend(SimpleFromFile)
diff --git a/spec/unit/plugins/linux/hostname_spec.rb b/spec/unit/plugins/linux/hostname_spec.rb
index 70ec0af4..2f522a44 100644
--- a/spec/unit/plugins/linux/hostname_spec.rb
+++ b/spec/unit/plugins/linux/hostname_spec.rb
@@ -21,8 +21,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Linux hostname plugin" do
before(:each) do
- @ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("linux/hostname.rb", PLUGIN_PATH))
+ @ohai = Ohai::System.new
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linux/hostname", File.expand_path("linux/hostname.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = "linux"
@plugin.stub(:from).with("hostname -s").and_return("katie")
diff --git a/spec/unit/plugins/linux/kernel_spec.rb b/spec/unit/plugins/linux/kernel_spec.rb
index f33aea80..58f0214c 100644
--- a/spec/unit/plugins/linux/kernel_spec.rb
+++ b/spec/unit/plugins/linux/kernel_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Linux kernel plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("linux/kernel.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linux/kernel", File.expand_path("linux/kernel.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin.stub(:from).with("uname -o").and_return("Linux")
@plugin.should_receive(:popen4).with("env lsmod").at_least(1).times
diff --git a/spec/unit/plugins/linux/lsb_spec.rb b/spec/unit/plugins/linux/lsb_spec.rb
index 8f2646c7..040aabe3 100644
--- a/spec/unit/plugins/linux/lsb_spec.rb
+++ b/spec/unit/plugins/linux/lsb_spec.rb
@@ -24,7 +24,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Linux lsb plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("linux/lsb.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linux/lsb", File.expand_path("linux/lsb.rb", PLUGIN_PATH))
@plugin[:os] = "linux"
@plugin.stub(:require_plugin).and_return(true)
@plugin.extend(SimpleFromFile)
diff --git a/spec/unit/plugins/linux/network_spec.rb b/spec/unit/plugins/linux/network_spec.rb
index a4a825ee..128c754c 100644
--- a/spec/unit/plugins/linux/network_spec.rb
+++ b/spec/unit/plugins/linux/network_spec.rb
@@ -278,7 +278,7 @@ IP_ROUTE_SCOPE
prepare_data
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("linux/network.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linux/network", File.expand_path("linux/network.rb", PLUGIN_PATH))
@plugin.stub(:popen4).with("ifconfig -a")
@plugin.stub(:popen4).with("arp -an")
diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb
index 10b3dd73..07edadb7 100644
--- a/spec/unit/plugins/linux/platform_spec.rb
+++ b/spec/unit/plugins/linux/platform_spec.rb
@@ -23,7 +23,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Linux plugin platform" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("linux/platform.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linux/platform", File.expand_path("linux/platform.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin.extend(SimpleFromFile)
@plugin[:os] = "linux"
diff --git a/spec/unit/plugins/linux/uptime_spec.rb b/spec/unit/plugins/linux/uptime_spec.rb
index 2c8fbcde..a321d5f6 100644
--- a/spec/unit/plugins/linux/uptime_spec.rb
+++ b/spec/unit/plugins/linux/uptime_spec.rb
@@ -21,8 +21,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Linux plugin uptime" do
before(:each) do
- @ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("linux/uptime.rb", PLUGIN_PATH))
+ @ohai = Ohai::System.new
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linux/uptime", File.expand_path("linux/uptime.rb", PLUGIN_PATH))
@plugin[:os] = "linux"
@plugin.require_plugin("uptime")
@double_file = double("/proc/uptime", { :gets => "18423 989" })
diff --git a/spec/unit/plugins/linux/virtualization_spec.rb b/spec/unit/plugins/linux/virtualization_spec.rb
index 800f37f9..7c07de16 100644
--- a/spec/unit/plugins/linux/virtualization_spec.rb
+++ b/spec/unit/plugins/linux/virtualization_spec.rb
@@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Linux virtualization platform" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("linux/virtualization.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "linux/virtualization", File.expand_path("linux/virtualization.rb", PLUGIN_PATH))
@plugin[:os] = "linux"
@plugin.stub(:require_plugin).and_return(true)
@plugin.extend(SimpleFromFile)
diff --git a/spec/unit/plugins/lua_spec.rb b/spec/unit/plugins/lua_spec.rb
index 3883aabf..3cedc357 100644
--- a/spec/unit/plugins/lua_spec.rb
+++ b/spec/unit/plugins/lua_spec.rb
@@ -23,7 +23,7 @@ describe Ohai::System, "plugin lua" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "lua.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "lua", File.join(PLUGIN_PATH, "lua.rb"))
@plugin[:languages] = Mash.new
@plugin.stub(:require_plugin).and_return(true)
@status = 0
diff --git a/spec/unit/plugins/mono_spec.rb b/spec/unit/plugins/mono_spec.rb
index a7543aec..94aadd9e 100644
--- a/spec/unit/plugins/mono_spec.rb
+++ b/spec/unit/plugins/mono_spec.rb
@@ -23,7 +23,7 @@ describe Ohai::System, "plugin mono" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "mono.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "mono", File.join(PLUGIN_PATH, "mono.rb"))
@plugin[:languages] = Mash.new
@plugin.stub(:require_plugin).and_return(true)
@status = 0
diff --git a/spec/unit/plugins/netbsd/hostname_spec.rb b/spec/unit/plugins/netbsd/hostname_spec.rb
index caaf864b..5944c6f9 100644
--- a/spec/unit/plugins/netbsd/hostname_spec.rb
+++ b/spec/unit/plugins/netbsd/hostname_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "NetBSD hostname plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("netbsd/hostname.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "netbsd/hostname", File.expand_path("netbsd/hostname.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = "netbsd"
@plugin.stub(:from).with("hostname -s").and_return("katie")
diff --git a/spec/unit/plugins/netbsd/kernel_spec.rb b/spec/unit/plugins/netbsd/kernel_spec.rb
index 8ec33dc3..20e7a0f1 100644
--- a/spec/unit/plugins/netbsd/kernel_spec.rb
+++ b/spec/unit/plugins/netbsd/kernel_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "NetBSD kernel plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("netbsd/kernel.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "netbsd/kernel", File.expand_path("netbsd/kernel.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin.stub(:from).with("uname -i").and_return("foo")
@plugin.stub(:from_with_regex).with("sysctl kern.securelevel", /kern.securelevel=(.+)$/).and_return("kern.securelevel: 1")
diff --git a/spec/unit/plugins/netbsd/platform_spec.rb b/spec/unit/plugins/netbsd/platform_spec.rb
index cf14cfb9..7131c64e 100644
--- a/spec/unit/plugins/netbsd/platform_spec.rb
+++ b/spec/unit/plugins/netbsd/platform_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "NetBSD plugin platform" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("netbsd/platform.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "netbsd/platform", File.expand_path("netbsd/platform.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin.stub(:from).with("uname -s").and_return("NetBSD")
@plugin.stub(:from).with("uname -r").and_return("4.5")
diff --git a/spec/unit/plugins/network_spec.rb b/spec/unit/plugins/network_spec.rb
index a5fc58be..d9a540af 100644
--- a/spec/unit/plugins/network_spec.rb
+++ b/spec/unit/plugins/network_spec.rb
@@ -150,7 +150,7 @@ describe Ohai::System, "Network Plugin" do
describe "with linux" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "network.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "network", File.join(PLUGIN_PATH, "network.rb"))
@plugin.stub(:require_plugin).and_return(true)
@plugin["network"] = basic_data["linux"]["network"]
end
diff --git a/spec/unit/plugins/nodejs_spec.rb b/spec/unit/plugins/nodejs_spec.rb
index 0159bdad..4009f511 100644
--- a/spec/unit/plugins/nodejs_spec.rb
+++ b/spec/unit/plugins/nodejs_spec.rb
@@ -22,7 +22,7 @@ describe Ohai::System, "plugin nodejs" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "nodejs.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "nodejs", File.join(PLUGIN_PATH, "nodejs.rb"))
@plugin.stub(:require_plugin)
@plugin[:languages] = Mash.new
@status = 0
diff --git a/spec/unit/plugins/ohai_spec.rb b/spec/unit/plugins/ohai_spec.rb
index c5cbd995..9b7a19be 100644
--- a/spec/unit/plugins/ohai_spec.rb
+++ b/spec/unit/plugins/ohai_spec.rb
@@ -23,7 +23,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "plugin ohai" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "ohai.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "ohai", File.join(PLUGIN_PATH, "ohai.rb"))
@plugin.stub(:require_plugin).and_return(true)
end
diff --git a/spec/unit/plugins/ohai_time_spec.rb b/spec/unit/plugins/ohai_time_spec.rb
index 12a5d7b0..a84dd0d2 100644
--- a/spec/unit/plugins/ohai_time_spec.rb
+++ b/spec/unit/plugins/ohai_time_spec.rb
@@ -21,8 +21,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "plugin ohai_time" do
before(:each) do
- @ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "ohai_time.rb"))
+ @ohai = Ohai::System.new
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "ohai_time", File.join(PLUGIN_PATH, "ohai_time.rb"))
@plugin.stub(:require_plugin).and_return(true)
end
diff --git a/spec/unit/plugins/openbsd/hostname_spec.rb b/spec/unit/plugins/openbsd/hostname_spec.rb
index f50b04c2..51ff6f79 100644
--- a/spec/unit/plugins/openbsd/hostname_spec.rb
+++ b/spec/unit/plugins/openbsd/hostname_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "OpenBSD hostname plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("openbsd/hostname.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "openbsd/hostname", File.expand_path("openbsd/hostname.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = "openbsd"
@plugin.stub(:from).with("hostname -s").and_return("katie")
diff --git a/spec/unit/plugins/openbsd/kernel_spec.rb b/spec/unit/plugins/openbsd/kernel_spec.rb
index afcf1406..e1ccce4f 100644
--- a/spec/unit/plugins/openbsd/kernel_spec.rb
+++ b/spec/unit/plugins/openbsd/kernel_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "OpenBSD kernel plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("openbsd/kernel.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "openbsd/kernel", File.expand_path("openbsd/kernel.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin.stub(:from).with("uname -i").and_return("foo")
@plugin.stub(:from_with_regex).with("sysctl kern.securelevel", /kern.securelevel=(.+)$/).and_return("kern.securelevel: 1")
diff --git a/spec/unit/plugins/openbsd/platform_spec.rb b/spec/unit/plugins/openbsd/platform_spec.rb
index 7de37054..c9f22514 100644
--- a/spec/unit/plugins/openbsd/platform_spec.rb
+++ b/spec/unit/plugins/openbsd/platform_spec.rb
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "OpenBSD plugin platform" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("openbsd/platform.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "openbsd/platform", File.expand_path("openbsd/platform.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin.stub(:from).with("uname -s").and_return("OpenBSD")
@plugin.stub(:from).with("uname -r").and_return("4.5")
diff --git a/spec/unit/plugins/os_spec.rb b/spec/unit/plugins/os_spec.rb
index 5ed74ea7..3679a228 100644
--- a/spec/unit/plugins/os_spec.rb
+++ b/spec/unit/plugins/os_spec.rb
@@ -23,8 +23,8 @@ ORIGINAL_CONFIG_HOST_OS = ::RbConfig::CONFIG['host_os']
describe Ohai::System, "plugin os" do
before(:each) do
- @ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "os.rb"))
+ @ohai = Ohai::System.new
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "os", File.join(PLUGIN_PATH, "os.rb"))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:languages] = Mash.new
@plugin[:languages][:ruby] = Mash.new
diff --git a/spec/unit/plugins/passwd_spec.rb b/spec/unit/plugins/passwd_spec.rb
index 51cc912b..bd8c7775 100644
--- a/spec/unit/plugins/passwd_spec.rb
+++ b/spec/unit/plugins/passwd_spec.rb
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "plugin etc" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "passwd.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "passwd", File.join(PLUGIN_PATH, "passwd.rb"))
@plugin.stub(:require_plugin).and_return(true)
end
diff --git a/spec/unit/plugins/perl_spec.rb b/spec/unit/plugins/perl_spec.rb
index 4c95ea93..e25fac02 100644
--- a/spec/unit/plugins/perl_spec.rb
+++ b/spec/unit/plugins/perl_spec.rb
@@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "plugin perl" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "perl.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "perl", File.join(PLUGIN_PATH, "perl.rb"))
@plugin[:languages] = Mash.new
@plugin.stub(:require_plugin).and_return(true)
@pid = 2342
diff --git a/spec/unit/plugins/php_spec.rb b/spec/unit/plugins/php_spec.rb
index 084fa496..8ed569a2 100644
--- a/spec/unit/plugins/php_spec.rb
+++ b/spec/unit/plugins/php_spec.rb
@@ -22,7 +22,7 @@ describe Ohai::System, "plugin php" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "php.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "php", File.join(PLUGIN_PATH, "php.rb"))
@plugin[:languages] = Mash.new
@plugin.stub(:require_plugin).and_return(true)
@status = 0
diff --git a/spec/unit/plugins/platform_spec.rb b/spec/unit/plugins/platform_spec.rb
index e33b46a4..af048391 100644
--- a/spec/unit/plugins/platform_spec.rb
+++ b/spec/unit/plugins/platform_spec.rb
@@ -21,8 +21,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "plugin platform" do
before(:each) do
- @ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "platform.rb"))
+ @ohai = Ohai::System.new
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "platform", File.join(PLUGIN_PATH, "platform.rb"))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = 'monkey'
@plugin[:os_version] = 'poop'
diff --git a/spec/unit/plugins/python_spec.rb b/spec/unit/plugins/python_spec.rb
index 45725ab8..c6a5a1aa 100644
--- a/spec/unit/plugins/python_spec.rb
+++ b/spec/unit/plugins/python_spec.rb
@@ -23,7 +23,7 @@ describe Ohai::System, "plugin python" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "python.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "python", File.join(PLUGIN_PATH, "python.rb"))
@plugin[:languages] = Mash.new
@plugin.stub(:require_plugin).and_return(true)
@status = 0
diff --git a/spec/unit/plugins/rackspace_spec.rb b/spec/unit/plugins/rackspace_spec.rb
index e66820c1..c4fc7ffb 100644
--- a/spec/unit/plugins/rackspace_spec.rb
+++ b/spec/unit/plugins/rackspace_spec.rb
@@ -20,7 +20,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Ohai::System, "plugin rackspace" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "rackspace.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "rackspace", File.join(PLUGIN_PATH, "rackspace.rb"))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:network] = {:interfaces => {:eth0 => {"addresses"=> {
"1.2.3.4"=> {
diff --git a/spec/unit/plugins/root_group_spec.rb b/spec/unit/plugins/root_group_spec.rb
index 501264f2..f8492e69 100644
--- a/spec/unit/plugins/root_group_spec.rb
+++ b/spec/unit/plugins/root_group_spec.rb
@@ -23,7 +23,7 @@ ORIGINAL_CONFIG_HOST_OS = ::RbConfig::CONFIG['host_os']
describe Ohai::System, 'root_group' do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "root_group.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "root_group", File.join(PLUGIN_PATH, "root_group.rb"))
@plugin.stub(:require_plugin)
end
diff --git a/spec/unit/plugins/ruby_spec.rb b/spec/unit/plugins/ruby_spec.rb
index 3db81dd3..b7b55c13 100644
--- a/spec/unit/plugins/ruby_spec.rb
+++ b/spec/unit/plugins/ruby_spec.rb
@@ -25,7 +25,7 @@ describe Ohai::System, "plugin ruby" do
before(:all) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "ruby.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "ruby", File.join(PLUGIN_PATH, "ruby.rb"))
@plugin[:languages] = Mash.new
@plugin.require_plugin("ruby")
diff --git a/spec/unit/plugins/sigar/network_route_spec.rb b/spec/unit/plugins/sigar/network_route_spec.rb
index a2ce993c..6355bb2e 100644
--- a/spec/unit/plugins/sigar/network_route_spec.rb
+++ b/spec/unit/plugins/sigar/network_route_spec.rb
@@ -33,7 +33,7 @@ describe Ohai::System, "Sigar network route plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("sigar/network_route_spec.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "sigar/network_route_spec", File.expand_path("sigar/network_route_spec.rb", PLUGIN_PATH))
@sigar = double("Sigar")
@net_info_conf={
:default_gateway => "192.168.1.254",
diff --git a/spec/unit/plugins/solaris2/hostname_spec.rb b/spec/unit/plugins/solaris2/hostname_spec.rb
index c7082213..bc4fadbb 100644
--- a/spec/unit/plugins/solaris2/hostname_spec.rb
+++ b/spec/unit/plugins/solaris2/hostname_spec.rb
@@ -20,8 +20,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Solaris2.X hostname plugin" do
before(:each) do
- @ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("solaris2/hostname.rb", PLUGIN_PATH))
+ @ohai = Ohai::System.new
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "solaris2/hostname", File.expand_path("solaris2/hostname.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = "solaris2"
@plugin.stub(:from).with("hostname").and_return("kitteh")
diff --git a/spec/unit/plugins/solaris2/kernel_spec.rb b/spec/unit/plugins/solaris2/kernel_spec.rb
index 18bd9b6c..d7a7dab7 100644
--- a/spec/unit/plugins/solaris2/kernel_spec.rb
+++ b/spec/unit/plugins/solaris2/kernel_spec.rb
@@ -135,7 +135,7 @@ describe Ohai::System, "Solaris2.X kernel plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("solaris2/kernel.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "solaris2/kernel", File.expand_path("solaris2/kernel.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:kernel] = Mash.new
@plugin.stub(:from).with("uname -s").and_return("SunOS")
diff --git a/spec/unit/plugins/solaris2/network_spec.rb b/spec/unit/plugins/solaris2/network_spec.rb
index a06f43d2..494259a0 100644
--- a/spec/unit/plugins/solaris2/network_spec.rb
+++ b/spec/unit/plugins/solaris2/network_spec.rb
@@ -90,7 +90,7 @@ ROUTE_GET
@ifconfig_lines = solaris_ifconfig.split("\n")
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("solaris2/network.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "solaris2/network", File.expand_path("solaris2/network.rb", PLUGIN_PATH))
@plugin.stub(:require_plugin).and_return(true)
@plugin[:network] = Mash.new
diff --git a/spec/unit/plugins/solaris2/platform_spec.rb b/spec/unit/plugins/solaris2/platform_spec.rb
index 9739e033..4b28436b 100644
--- a/spec/unit/plugins/solaris2/platform_spec.rb
+++ b/spec/unit/plugins/solaris2/platform_spec.rb
@@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Solaris plugin platform" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("solaris2/platform.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "solaris2/platform", File.expand_path("solaris2/platform.rb", PLUGIN_PATH))
@plugin.extend(SimpleFromFile)
@plugin.stub(:require_plugin).and_return(true)
@plugin[:os] = "solaris2"
diff --git a/spec/unit/plugins/solaris2/virtualization_spec.rb b/spec/unit/plugins/solaris2/virtualization_spec.rb
index 8a568d8e..5c296db1 100644
--- a/spec/unit/plugins/solaris2/virtualization_spec.rb
+++ b/spec/unit/plugins/solaris2/virtualization_spec.rb
@@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Solaris virtualization platform" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.expand_path("solaris2/virtualization.rb", PLUGIN_PATH))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "solaris2/virtualization", File.expand_path("solaris2/virtualization.rb", PLUGIN_PATH))
@plugin[:os] = "solaris2"
@plugin.stub(:require_plugin).and_return(true)
@plugin.extend(SimpleFromFile)
diff --git a/spec/unit/plugins/ssh_host_keys_spec.rb b/spec/unit/plugins/ssh_host_keys_spec.rb
index 16303591..3170ab82 100644
--- a/spec/unit/plugins/ssh_host_keys_spec.rb
+++ b/spec/unit/plugins/ssh_host_keys_spec.rb
@@ -22,7 +22,7 @@ describe Ohai::System, "ssh_host_key plugin" do
before(:each) do
@ohai = Ohai::System.new
- @plugin = Ohai::DSL::Plugin.new(@ohai, File.join(PLUGIN_PATH, "ssh_host_key.rb"))
+ @plugin = Ohai::DSL::Plugin.new(@ohai, "ssh_host_key", File.join(PLUGIN_PATH, "ssh_host_key.rb"))
@plugin.stub(:require_plugin)
@plugin[:keys] = Mash.new
diff --git a/spec/unit/system_spec.rb b/spec/unit/system_spec.rb
index b2fcd536..f0829f2e 100644
--- a/spec/unit/system_spec.rb
+++ b/spec/unit/system_spec.rb
@@ -87,5 +87,28 @@ describe Ohai::System, "all_plugins" do
@ohai.should_receive(:require_plugin).with("darius")
@ohai.all_plugins
end
-
+end
+
+describe Ohai::System, "plugin metadata" do
+ before(:all) do
+ @ohai = Ohai::System.new
+ Ohai::Config[:plugin_path] = [PLUGIN_PATH]
+ @ohai.all_plugins
+ end
+
+ it "should save which plugin an attribute is defined in when the plugin and attribute have the same name" do
+ @ohai.metadata[:os][:_plugin_name].should eql(["os"])
+ end
+
+ it "should save which plugin an attribute is defined in when the plugin and attribute have different names" do
+ @ohai.metadata[:os_version][:_plugin_name].should eql(["os"])
+ end
+
+ it "should save which plugin an attribute is defined in when the plugin is a sub-plugin" do
+ @ohai.metadata[:languages][:ruby][:_plugin_name].should eql(["ruby"])
+ end
+
+ it "should save which plugin an attribute is defined in when the plugin has sub-plugins" do
+ @ohai.metadata[:languages][:_plugin_name].should eql(["languages"])
+ end
end