diff options
author | Luke Kanies <luke@madstop.com> | 2007-12-27 21:35:42 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-12-27 21:35:42 -0600 |
commit | 4e8bc40ad7a9c128e778dbafda6dadbade215c94 (patch) | |
tree | 5333dd69d051cb4b828d63a7006182917825e6a6 | |
parent | c4ed43c2a1ad9ab865e3da6b8b7fad28222c3451 (diff) | |
download | puppet-4e8bc40ad7a9c128e778dbafda6dadbade215c94.tar.gz puppet-4e8bc40ad7a9c128e778dbafda6dadbade215c94.tar.xz puppet-4e8bc40ad7a9c128e778dbafda6dadbade215c94.zip |
Fixing the inability to manage '/' directly. It was a result
of stripping extra and trailing slashes.
-rw-r--r-- | lib/puppet/type/pfile.rb | 4 | ||||
-rwxr-xr-x | test/ral/types/file.rb | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index f86e1e273..7d928d959 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -460,7 +460,9 @@ module Puppet super # Get rid of any duplicate slashes, and remove any trailing slashes. - @title = @title.gsub(/\/+/, "/").sub(/\/$/, "") + @title = @title.gsub(/\/+/, "/") + + @title.sub!(/\/$/, "") unless @title == "/" # Clean out as many references to any file paths as possible. # This was the source of many, many bugs. diff --git a/test/ral/types/file.rb b/test/ral/types/file.rb index a3a0c579a..aa2e63a89 100755 --- a/test/ral/types/file.rb +++ b/test/ral/types/file.rb @@ -1817,5 +1817,10 @@ class TestFile < Test::Unit::TestCase changes = obj.evaluate assert(changes.empty?, "Missing file with no ensure resulted in changes") end + + def test_root_dir_is_named_correctly + obj = Puppet::Type.newfile(:path => '/', :mode => 0755) + assert_equal("/", obj.title, "/ directory was changed to empty string") + end end |