diff options
-rwxr-xr-x | lib/puppet/filebucket.rb | 6 | ||||
-rw-r--r-- | lib/puppet/metric.rb | 6 | ||||
-rw-r--r-- | lib/puppet/type/pfile.rb | 3 | ||||
-rw-r--r-- | test/other/tc_metrics.rb | 4 |
4 files changed, 12 insertions, 7 deletions
diff --git a/lib/puppet/filebucket.rb b/lib/puppet/filebucket.rb index 8a613359c..e67b58668 100755 --- a/lib/puppet/filebucket.rb +++ b/lib/puppet/filebucket.rb @@ -60,7 +60,11 @@ module FileBucket @bucket = hash[:Path] hash.delete(:Path) else - @bucket = "/var/puppet/filebucket" + if defined? Puppet + @bucket = File.join(Puppet[:puppetroot], "bucket") + else + @bucket = File.expand_path("~/.filebucket") + end end # XXX this should really be done using Puppet::Type instances... diff --git a/lib/puppet/metric.rb b/lib/puppet/metric.rb index 4b606b87d..9a4fb46da 100644 --- a/lib/puppet/metric.rb +++ b/lib/puppet/metric.rb @@ -140,8 +140,8 @@ module Puppet unless FileTest.exist?(dir) tmp = dir.sub(/^\//,'') path = [File::SEPARATOR] - tmp.split(File::SEPARATOR).each { |dir| - path.push dir + tmp.split(File::SEPARATOR).each { |d| + path.push d unless FileTest.exist?(File.join(path)) Dir.mkdir(File.join(path)) end @@ -149,7 +149,7 @@ module Puppet end unless FileTest.directory?(dir) - raise "%s must be a directory" % dir + raise Puppet::Error.new("%s must be a directory" % dir) end path = self.path diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index dad42c019..3b8469458 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -754,7 +754,8 @@ module Puppet *file* is supported as a protocol)." @paramdoc[:filebucket] = "A repository for backing up files, including - over the network. Currently non-functional." + over the network. Argument must the name of an existing + filebucket." @name = :file @namevar = :path diff --git a/test/other/tc_metrics.rb b/test/other/tc_metrics.rb index 0e4519b24..24be0f9b1 100644 --- a/test/other/tc_metrics.rb +++ b/test/other/tc_metrics.rb @@ -54,13 +54,13 @@ if $haverrd end def setup - Puppet[:rrddir] = File.join(Dir.getwd,"rrdtests") + Puppet[:rrddir] = "/tmp/rrdtests" Puppet[:rrdgraph] = true Puppet[:loglevel] = :debug if __FILE__ == $0 end def teardown - system("rm -rf rrdtests") + system("rm -rf %s" % Puppet[:rrddir]) end def test_fakedata |