summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Rakefile2
-rw-r--r--lib/puppet/storage.rb2
-rw-r--r--lib/puppet/util.rb4
3 files changed, 6 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index 3da48a595..0e2e62d3a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -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|