[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:34:13 UTC 2010


The following commit has been merged in the upstream branch:
commit e119b04f7738f5ffb6b9bf353bb28b3d058302a5
Author: David Schmitt <david at dasz.at>
Date:   Thu Apr 29 17:32:40 2010 +0200

    Avoid setting the timeout before we know which timeout we should set.
    
    Signed-off-by: David Schmitt <david at dasz.at>

diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index b2563e9..82d2d45 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -308,13 +308,13 @@ class Puppet::Util::Settings
     def parse
         raise "No :config setting defined; cannot parse unknown config file" unless self[:config]
 
-        # Create a timer so that this file will get checked automatically
-        # and reparsed if necessary.
-        set_filetimeout_timer()
-
         @sync.synchronize do
             unsafe_parse(self[:config])
         end
+
+        # Create a timer so that this file will get checked automatically
+        # and reparsed if necessary.
+        set_filetimeout_timer()
     end
 
     # Unsafely parse the file -- this isn't thread-safe and causes plenty of problems if used directly.
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb
index 24bd04b..bf0776f 100755
--- a/spec/unit/util/settings.rb
+++ b/spec/unit/util/settings.rb
@@ -512,6 +512,26 @@ describe Puppet::Util::Settings do
             @settings.parse
             @settings[:myarg].should == ""
         end
+
+        describe "and when reading a non-positive filetimeout value from the config file" do
+            before do
+                @settings.setdefaults :foo, :filetimeout => [5, "eh"]
+
+                somefile = "/some/file"
+                text = "[main]
+                filetimeout = -1
+                "
+                File.expects(:read).with(somefile).returns(text)
+                @settings[:config] = somefile
+            end
+
+            it "should not set a timer" do
+                EventLoop::Timer.expects(:new).never
+
+                @settings.parse
+                puts "2", @settings[:filetimeout]
+            end
+        end
     end
 
     describe "when reparsing its configuration" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list