diff options
-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$ |