[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:25 UTC 2010


The following commit has been merged in the upstream branch:
commit fc92408b7702eb0258c32805b8c250d448ec5406
Author: David Schmitt <david at dasz.at>
Date:   Tue May 18 16:34:13 2010 +0200

    Adapt Util::Storage specs and avoid trying to lock on directories

diff --git a/lib/puppet/util/storage.rb b/lib/puppet/util/storage.rb
index 01c4111..1b3d498 100644
--- a/lib/puppet/util/storage.rb
+++ b/lib/puppet/util/storage.rb
@@ -60,6 +60,10 @@ class Puppet::Util::Storage
             end
             return
         end
+        unless File.file?(Puppet[:statefile])
+            Puppet.warning("Checksumfile %s is not a file, ignoring" % Puppet[:statefile])
+            return
+        end
         Puppet::Util.benchmark(:debug, "Loaded state") do
             Puppet::Util::FileLocking.readlock(Puppet[:statefile]) do |file|
                 begin
diff --git a/spec/unit/util/storage.rb b/spec/unit/util/storage.rb
index c786145..09eb6b2 100755
--- a/spec/unit/util/storage.rb
+++ b/spec/unit/util/storage.rb
@@ -8,7 +8,9 @@ require 'tempfile'
 require 'puppet/util/storage'
 
 describe Puppet::Util::Storage do
+
     before(:all) do
+        @basepath = Puppet.features.posix? ? "/somepath" : "C:/somepath"
         Puppet[:statedir] = Dir.tmpdir()
     end
 
@@ -41,8 +43,8 @@ describe Puppet::Util::Storage do
 
     describe "when caching a Puppet::Type" do
         before(:all) do
-            @file_test = Puppet::Type.type(:file).new(:name => "/yayness", :check => %w{checksum type})
-            @exec_test = Puppet::Type.type(:exec).new(:name => "/bin/ls /yayness")
+            @file_test = Puppet::Type.type(:file).new(:name => @basepath+"/yayness", :check => %w{checksum type})
+            @exec_test = Puppet::Type.type(:exec).new(:name => @basepath+"/bin/ls /yayness")
         end
 
         it "should return an empty hash" do
@@ -53,9 +55,9 @@ describe Puppet::Util::Storage do
         it "should add the resource ref to its internal state" do
             Puppet::Util::Storage.state().should == {}
             Puppet::Util::Storage.cache(@file_test)
-            Puppet::Util::Storage.state().should == {"File[/yayness]"=>{}}
+            Puppet::Util::Storage.state().should == {"File[#{@basepath}/yayness]"=>{}}
             Puppet::Util::Storage.cache(@exec_test)
-            Puppet::Util::Storage.state().should == {"File[/yayness]"=>{}, "Exec[/bin/ls /yayness]"=>{}}
+            Puppet::Util::Storage.state().should == {"File[#{@basepath}/yayness]"=>{}, "Exec[#{@basepath}/bin/ls /yayness]"=>{}}
         end
     end
 
@@ -173,7 +175,6 @@ describe Puppet::Util::Storage do
             it "should fail gracefully on load() if the state file is not a regular file" do
                 @state_file.close!()
                 Dir.mkdir(Puppet[:statefile])
-                File.expects(:rename).returns(0)
 
                 proc { Puppet::Util::Storage.load() }.should_not raise_error()
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list