summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-05-22 14:45:35 -0500
committerJames Turnbull <james@ubuntu904.lovedthanlost.net>2009-05-26 13:43:39 +1000
commit7650fb299768c23241784671e3abeb272ee87fab (patch)
treecdaa513cbcdfe36b019ee3001c64b2b6a940c4f5
parent3995e7026dd40778cff1025a8e7e28eec833545f (diff)
downloadpuppet-7650fb299768c23241784671e3abeb272ee87fab.tar.gz
Not trying to load files that get removed in pluginsyncing
Previously any changed file got loaded; now we only try to load files that are still present. Signed-off-by: Luke Kanies <luke@madstop.com>
-rw-r--r--lib/puppet/configurer/plugin_handler.rb1
-rwxr-xr-xspec/unit/configurer/plugin_handler.rb12
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/puppet/configurer/plugin_handler.rb b/lib/puppet/configurer/plugin_handler.rb
index def6a1707..e934f5877 100644
--- a/lib/puppet/configurer/plugin_handler.rb
+++ b/lib/puppet/configurer/plugin_handler.rb
@@ -13,6 +13,7 @@ module Puppet::Configurer::PluginHandler
end
def load_plugin(file)
+ return unless FileTest.exist?(file)
return if FileTest.directory?(file)
begin
diff --git a/spec/unit/configurer/plugin_handler.rb b/spec/unit/configurer/plugin_handler.rb
index 7baece936..7f59d5bb3 100755
--- a/spec/unit/configurer/plugin_handler.rb
+++ b/spec/unit/configurer/plugin_handler.rb
@@ -57,6 +57,7 @@ describe Puppet::Configurer::PluginHandler do
end
it "should load each downloaded file" do
+ FileTest.stubs(:exist?).returns true
downloader = mock 'downloader'
Puppet::Configurer::Downloader.expects(:new).returns downloader
@@ -72,12 +73,21 @@ describe Puppet::Configurer::PluginHandler do
end
it "should load plugins when asked to do so" do
+ FileTest.stubs(:exist?).returns true
@pluginhandler.expects(:load).with("foo")
@pluginhandler.load_plugin("foo")
end
+ it "should not try to load files that don't exist" do
+ FileTest.expects(:exist?).with("foo").returns true
+ @pluginhandler.expects(:load).never
+
+ @pluginhandler.load_plugin("foo")
+ end
+
it "should not try to load directories" do
+ FileTest.stubs(:exist?).returns true
FileTest.expects(:directory?).with("foo").returns true
@pluginhandler.expects(:load).never
@@ -85,6 +95,7 @@ describe Puppet::Configurer::PluginHandler do
end
it "should warn but not fail if loading a file raises an exception" do
+ FileTest.stubs(:exist?).returns true
@pluginhandler.expects(:load).with("foo").raises "eh"
Puppet.expects(:err)
@@ -92,6 +103,7 @@ describe Puppet::Configurer::PluginHandler do
end
it "should warn but not fail if loading a file raises a LoadError" do
+ FileTest.stubs(:exist?).returns true
@pluginhandler.expects(:load).with("foo").raises LoadError.new("eh")
Puppet.expects(:err)