diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-26 21:58:38 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-26 21:58:38 +0000 |
commit | 2db68781a11de7b135d0abc332ed144c4e4b71c3 (patch) | |
tree | 26e49696cb2e237c5d993df9fb771bc943aab6c3 | |
parent | 6475487218f9dbe210f79e59b9b7c1be46f18280 (diff) | |
download | puppet-2db68781a11de7b135d0abc332ed144c4e4b71c3.tar.gz puppet-2db68781a11de7b135d0abc332ed144c4e4b71c3.tar.xz puppet-2db68781a11de7b135d0abc332ed144c4e4b71c3.zip |
Fixing #434.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2096 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/type/pfile.rb | 4 | ||||
-rwxr-xr-x | test/types/file.rb | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 2551106a8..7035cf2dd 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -230,6 +230,10 @@ module Puppet self.fail "You cannot specify both content and a source" end end + + def self.[](path) + super(path.gsub(/\/+/, '/').sub(/\/$/, '')) + end # List files, but only one level deep. def self.list(base = "/") diff --git a/test/types/file.rb b/test/types/file.rb index 321bfaef6..e1cb06978 100755 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -1924,6 +1924,14 @@ class TestFile < Test::Unit::TestCase assert_apply(file) assert(! FileTest.exists?(path), "File was not removed") end + + # Testing #434 + def test_stripping_extra_slashes_during_lookup + file = Puppet::Type.newfile(:path => "/one/two") + %w{/one/two/ /one/two /one//two //one//two//}.each do |path| + assert(Puppet::Type.type(:file)[path], "could not look up file via path %s" % path) + end + end end # $Id$ |