Fix ticket 1596 in new fileset code, use tmpdir in fileserver tests.

This commit is contained in:
Paul Nasrat 2008-09-29 11:57:26 +01:00 коммит произвёл James Turnbull
Родитель a30ecf2aef
Коммит b2f0d872a2
4 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -1,4 +1,6 @@
0.24.x
Fixed #1596 - Deploying file resources with ++ generates error
Fixed #1610 - Raise "Filebucketed" messages to Notice priority
Added a number of confines to package providers

Просмотреть файл

@ -20,7 +20,7 @@ class Puppet::FileServing::Fileset
# Now strip off the leading path, so each file becomes relative, and remove
# any slashes that might end up at the beginning of the path.
result = files.collect { |file| file.sub(%r{^#{@path}/*}, '') }
result = files.collect { |file| file.sub(%r{^#{Regexp.escape(@path)}/*}, '') }
# And add the path itself.
result.unshift(".")

Просмотреть файл

@ -176,6 +176,15 @@ describe Puppet::FileServing::Fileset, " when recursing" do
@fileset.links = :manage
@fileset.files.sort.should == @files.sort
end
it "should succeed when paths have regexp significant characters" do
@path = "/my/path/rV1x2DafFr0R6tGG+1bbk++++TM"
File.expects(:lstat).with(@path).returns stub("stat", :directory? => true)
@fileset = Puppet::FileServing::Fileset.new(@path)
mock_dir_structure(@path)
@fileset.recurse = true
@fileset.files.sort.should == @files.sort
end
end
describe Puppet::FileServing::Fileset, " when following links that point to missing files" do

Просмотреть файл

@ -20,7 +20,7 @@ describe Puppet::Network::Handler do
end
before do
@basedir = File.join("/tmp", "test_network_handler")
@basedir = File.join(Dir.tmpdir(), "test_network_handler")
Dir.mkdir(@basedir)
@file = File.join(@basedir, "aFile")
@link = File.join(@basedir, "aLink")