summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@opscode.com>2013-10-14 21:45:29 -0700
committerClaire McQuin <claire@opscode.com>2013-10-17 12:07:31 -0700
commitb6b9d220869bd5c01be2e1a247e324222bb7a1ca (patch)
tree7c9be2433d104ffac6c20a2bd81ae72de4c3131c
parentbbb4b0fbf4a25c62014c7912fbbc8c81ea186d60 (diff)
downloadohai-b6b9d220869bd5c01be2e1a247e324222bb7a1ca.tar.gz
change :providers to :_providers to avoid attribute conflicts
-rw-r--r--lib/ohai/dsl/plugin.rb4
-rw-r--r--lib/ohai/loader.rb4
-rw-r--r--lib/ohai/runner.rb2
-rw-r--r--lib/ohai/system.rb2
-rw-r--r--spec/ohai/dsl/plugin_spec.rb2
-rw-r--r--spec/unit/loader_spec.rb2
-rw-r--r--spec/unit/runner_spec.rb34
-rw-r--r--spec/unit/system_spec.rb14
8 files changed, 32 insertions, 32 deletions
diff --git a/lib/ohai/dsl/plugin.rb b/lib/ohai/dsl/plugin.rb
index acb6bcc3..f3bb42cb 100644
--- a/lib/ohai/dsl/plugin.rb
+++ b/lib/ohai/dsl/plugin.rb
@@ -236,8 +236,8 @@ module Ohai
a = a[part]
end
end
- a[:providers] ||= []
- a[:providers] << self
+ a[:_providers] ||= []
+ a[:_providers] << self
end
end
diff --git a/lib/ohai/loader.rb b/lib/ohai/loader.rb
index 288100d9..c1ec7941 100644
--- a/lib/ohai/loader.rb
+++ b/lib/ohai/loader.rb
@@ -78,8 +78,8 @@ module Ohai
end
end
- a[:providers] ||= []
- a[:providers] << plugin
+ a[:_providers] ||= []
+ a[:_providers] << plugin
end
end
diff --git a/lib/ohai/runner.rb b/lib/ohai/runner.rb
index bde4d6da..e2f5ed18 100644
--- a/lib/ohai/runner.rb
+++ b/lib/ohai/runner.rb
@@ -70,7 +70,7 @@ module Ohai
raise NoAttributeError, "Cannot find plugin providing attribute \'#{attribute}\'" unless attrs[part]
attrs = attrs[part]
end
- providers << attrs[:providers]
+ providers << attrs[:_providers]
providers.flatten!
end
providers.uniq!
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb
index dc68deaa..50a1611d 100644
--- a/lib/ohai/system.rb
+++ b/lib/ohai/system.rb
@@ -103,7 +103,7 @@ module Ohai
plugins = []
if providers.is_a?(Mash)
providers.keys.each do |provider|
- if provider.eql?("providers")
+ if provider.eql?("_providers")
plugins << providers[provider]
else
plugins << collect_providers(providers[provider])
diff --git a/spec/ohai/dsl/plugin_spec.rb b/spec/ohai/dsl/plugin_spec.rb
index e675544b..4bdda824 100644
--- a/spec/ohai/dsl/plugin_spec.rb
+++ b/spec/ohai/dsl/plugin_spec.rb
@@ -281,7 +281,7 @@ describe Ohai::DSL::Plugin::VersionVI do
plugins << p
end
- @ohai.attributes[:attribute][:providers].should eql(plugins)
+ @ohai.attributes[:attribute][:_providers].should eql(plugins)
end
end
diff --git a/spec/unit/loader_spec.rb b/spec/unit/loader_spec.rb
index b6353061..12bc55e3 100644
--- a/spec/unit/loader_spec.rb
+++ b/spec/unit/loader_spec.rb
@@ -112,7 +112,7 @@ EOF
end
plugins.each { |plugin| @loader.collect_provides(plugin) }
- @ohai.attributes[:attr][:providers].should eql(plugins)
+ @ohai.attributes[:attr][:_providers].should eql(plugins)
end
end
end
diff --git a/spec/unit/runner_spec.rb b/spec/unit/runner_spec.rb
index bcd44f6b..efa3985c 100644
--- a/spec/unit/runner_spec.rb
+++ b/spec/unit/runner_spec.rb
@@ -104,9 +104,9 @@ describe Ohai::Runner, "run_plugin" do
it "should locate the provider" do
@ohai.attributes[:thing] = Mash.new
- @ohai.attributes[:thing][:providers] = [@plugin1]
+ @ohai.attributes[:thing][:_providers] = [@plugin1]
@ohai.attributes[:other] = Mash.new
- @ohai.attributes[:other][:providers] = [@plugin2]
+ @ohai.attributes[:other][:_providers] = [@plugin2]
@runner.should_receive(:fetch_providers).twice.with(["thing"]).and_return([@plugin1])
@runner.should_receive(:fetch_providers).with([]).and_return([])
@@ -149,9 +149,9 @@ describe Ohai::Runner, "run_plugin" do
it "should locate each provider" do
@ohai.attributes[:thing] = Mash.new
- @ohai.attributes[:thing][:providers] = [@plugin1, @plugin2]
+ @ohai.attributes[:thing][:_providers] = [@plugin1, @plugin2]
@ohai.attributes[:other] = Mash.new
- @ohai.attributes[:other][:providers] = [@plugin3]
+ @ohai.attributes[:other][:_providers] = [@plugin3]
@runner.should_receive(:fetch_providers).exactly(3).times.with(["thing"]).and_return([@plugin1, @plugin2])
@runner.should_receive(:fetch_providers).twice.with([]).and_return([])
@@ -203,11 +203,11 @@ describe Ohai::Runner, "run_plugin" do
it "should locate each provider" do
@ohai.attributes[:one] = Mash.new
- @ohai.attributes[:one][:providers] = [@plugin1]
+ @ohai.attributes[:one][:_providers] = [@plugin1]
@ohai.attributes[:two] = Mash.new
- @ohai.attributes[:two][:providers] = [@plugin2]
+ @ohai.attributes[:two][:_providers] = [@plugin2]
@ohai.attributes[:three] = Mash.new
- @ohai.attributes[:three][:providers] = [@plugin3]
+ @ohai.attributes[:three][:_providers] = [@plugin3]
@runner.should_receive(:fetch_providers).twice.with([]).and_return([])
@runner.should_receive(:fetch_providers).exactly(3).times.with(["one", "two"]).and_return([@plugin1, @plugin2])
@@ -285,11 +285,11 @@ describe Ohai::Runner, "run_plugin" do
@pluginA, @pluginB, @pluginC = @plugins
@ohai.attributes[:A] = Mash.new
- @ohai.attributes[:A][:providers] = [@pluginA]
+ @ohai.attributes[:A][:_providers] = [@pluginA]
@ohai.attributes[:B] = Mash.new
- @ohai.attributes[:B][:providers] = [@pluginB]
+ @ohai.attributes[:B][:_providers] = [@pluginB]
@ohai.attributes[:C] = Mash.new
- @ohai.attributes[:C][:providers] = [@pluginC]
+ @ohai.attributes[:C][:_providers] = [@pluginC]
@runner.stub(:fetch_providers).with(["C"]).and_return([@pluginC])
@runner.stub(:fetch_providers).with([]).and_return([])
@@ -328,7 +328,7 @@ describe Ohai::Runner, "fetch_providers" do
it "should return the provider" do
plugin = Ohai::DSL::Plugin.new(@ohai, "")
@ohai.attributes[:single] = Mash.new
- @ohai.attributes[:single][:providers] = [plugin]
+ @ohai.attributes[:single][:_providers] = [plugin]
dependency_providers = @runner.fetch_providers(["single"])
dependency_providers.should eql([plugin])
@@ -340,7 +340,7 @@ describe Ohai::Runner, "fetch_providers" do
plugin1 = Ohai::DSL::Plugin.new(@ohai, "")
plugin2 = Ohai::DSL::Plugin.new(@ohai, "")
@ohai.attributes[:single] = Mash.new
- @ohai.attributes[:single][:providers] = [plugin1, plugin2]
+ @ohai.attributes[:single][:_providers] = [plugin1, plugin2]
dependency_providers = @runner.fetch_providers(["single"])
dependency_providers.should eql([plugin1, plugin2])
@@ -354,9 +354,9 @@ describe Ohai::Runner, "fetch_providers" do
plugin1 = Ohai::DSL::Plugin.new(@ohai, "")
plugin2 = Ohai::DSL::Plugin.new(@ohai, "")
@ohai.attributes[:one] = Mash.new
- @ohai.attributes[:one][:providers] = [plugin1]
+ @ohai.attributes[:one][:_providers] = [plugin1]
@ohai.attributes[:two] = Mash.new
- @ohai.attributes[:two][:providers] = [plugin2]
+ @ohai.attributes[:two][:_providers] = [plugin2]
dependency_providers = @runner.fetch_providers(["one", "two"])
dependency_providers.should eql([plugin1, plugin2])
@@ -367,9 +367,9 @@ describe Ohai::Runner, "fetch_providers" do
it "should return unique providers" do
plugin = Ohai::DSL::Plugin.new(@ohai, "")
@ohai.attributes[:one] = Mash.new
- @ohai.attributes[:one][:providers] = [plugin]
+ @ohai.attributes[:one][:_providers] = [plugin]
@ohai.attributes[:two] = Mash.new
- @ohai.attributes[:two][:providers] = [plugin]
+ @ohai.attributes[:two][:_providers] = [plugin]
dependency_providers = @runner.fetch_providers(["one", "two"])
dependency_providers.should eql([plugin])
@@ -383,7 +383,7 @@ describe Ohai::Runner, "fetch_providers" do
@ohai.attributes[:top] = Mash.new
@ohai.attributes[:top][:middle] = Mash.new
@ohai.attributes[:top][:middle][:bottom] = Mash.new
- @ohai.attributes[:top][:middle][:bottom][:providers] = [plugin]
+ @ohai.attributes[:top][:middle][:bottom][:_providers] = [plugin]
dependency_providers = @runner.fetch_providers(["top/middle/bottom"])
dependency_providers.should eql([plugin])
diff --git a/spec/unit/system_spec.rb b/spec/unit/system_spec.rb
index ee5a8a81..dd7c83f0 100644
--- a/spec/unit/system_spec.rb
+++ b/spec/unit/system_spec.rb
@@ -256,14 +256,14 @@ EOF
it "should find all the plugins providing attributes" do
a = @ohai.attributes
a[:zero] = Mash.new
- a[:zero][:providers] = [@plugins[0]]
+ a[:zero][:_providers] = [@plugins[0]]
a[:one] = Mash.new
- a[:one][:providers] = [@plugins[1]]
+ a[:one][:_providers] = [@plugins[1]]
a[:one][:two] = Mash.new
- a[:one][:two][:providers] = [@plugins[2]]
+ a[:one][:two][:_providers] = [@plugins[2]]
a[:stub] = Mash.new
a[:stub][:three] = Mash.new
- a[:stub][:three][:providers] = [@plugins[3]]
+ a[:stub][:three][:_providers] = [@plugins[3]]
providers = @ohai.collect_providers(@ohai.attributes)
providers.size.should eql(@plugins.size)
@@ -355,7 +355,7 @@ EOF
@ohai.v6_dependency_solver['v6plugin'] = @v6plugin
@ohai.v6_dependency_solver['v7plugin'] = @v7plugin
@ohai.attributes[:message] = Mash.new
- @ohai.attributes[:message][:providers] = [@v7plugin]
+ @ohai.attributes[:message][:_providers] = [@v7plugin]
end
it "should run the plugin it requires" do
@@ -402,9 +402,9 @@ EOF
a = @ohai.attributes
a[:message] = Mash.new
- a[:message][:providers] = [@v7plugin]
+ a[:message][:_providers] = [@v7plugin]
a[:other] = Mash.new
- a[:other][:providers] = [@other]
+ a[:other][:_providers] = [@other]
end
it "should resolve the v7 plugin dependencies" do