diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-22 22:18:20 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-22 22:18:20 +0000 |
commit | 3aac2e1eb48efa8f97d9c2e00b224c448cb77e8f (patch) | |
tree | e747de512394b53bab7441a99f3422ffb1d8e2ff | |
parent | 48082a10240db22c39a61811cc98ee3ea6bf68a5 (diff) | |
download | puppet-3aac2e1eb48efa8f97d9c2e00b224c448cb77e8f.tar.gz puppet-3aac2e1eb48efa8f97d9c2e00b224c448cb77e8f.tar.xz puppet-3aac2e1eb48efa8f97d9c2e00b224c448cb77e8f.zip |
Some small housekeeping things that I saw while doing other bug hunting
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1672 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | Rakefile | 2 | ||||
-rw-r--r-- | lib/puppet/storage.rb | 2 | ||||
-rw-r--r-- | lib/puppet/util.rb | 4 |
3 files changed, 6 insertions, 2 deletions
@@ -53,7 +53,7 @@ if project.has?(:gem) '--title' << 'Puppet - Configuration Management' << '--main' << 'README' << '--line-numbers' - task.test_file = "test/test" + task.test_file = "test/Rakefile" end end diff --git a/lib/puppet/storage.rb b/lib/puppet/storage.rb index 9ed63c381..38fea42bb 100644 --- a/lib/puppet/storage.rb +++ b/lib/puppet/storage.rb @@ -40,6 +40,7 @@ module Puppet if Puppet[:statefile].nil? raise Puppet::DevError, "Somehow the statefile is nil" end + Puppet.config.use(:puppet) unless File.exists?(Puppet[:statefile]) unless defined? @@state and ! @@state.nil? @@ -79,7 +80,6 @@ module Puppet end def self.store - Puppet.config.use(:puppet) Puppet.debug "Storing state" unless FileTest.exist?(Puppet[:statefile]) diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index 049d66b49..fea1e68a6 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -76,6 +76,10 @@ module Util # tmp file. def self.writelock(file, mode = 0600) tmpfile = file + ".tmp" + unless FileTest.directory?(File.dirname(tmpfile)) + raise Puppet::DevError, "Cannot create %s; directory %s does not exist" % + [file, File.dirname(file)] + end self.sync(file).synchronize(Sync::EX) do File.open(file, "w", mode) do |rf| rf.lock_exclusive do |lrf| |