diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-06-20 01:34:24 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-06-20 01:34:24 +0000 |
| commit | 15905bd5ee0d692e44bed516fe720c278ce67835 (patch) | |
| tree | d3f461948bae4d85164cdf4bee15840c48f64253 | |
| parent | 0a1e847961977221b36d7d6c8babffe6fa69c4b6 (diff) | |
| download | puppet-15905bd5ee0d692e44bed516fe720c278ce67835.tar.gz puppet-15905bd5ee0d692e44bed516fe720c278ce67835.tar.xz puppet-15905bd5ee0d692e44bed516fe720c278ce67835.zip | |
Fixing broken symlink behaviour mentioned on the list
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1303 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | lib/puppet/type/pfile/target.rb | 4 | ||||
| -rw-r--r-- | test/types/file.rb | 25 |
2 files changed, 28 insertions, 1 deletions
diff --git a/lib/puppet/type/pfile/target.rb b/lib/puppet/type/pfile/target.rb index ba71c7f58..04f2c986e 100644 --- a/lib/puppet/type/pfile/target.rb +++ b/lib/puppet/type/pfile/target.rb @@ -12,7 +12,9 @@ module Puppet # Anything else, basically newvalue(/./) do - # Do nothing here, because sync is always called from the ensure state. + if @parent.state(:ensure).insync? + mklink() + end end # Create our link. diff --git a/test/types/file.rb b/test/types/file.rb index 96a4aa617..7892a346d 100644 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -1267,6 +1267,31 @@ class TestFile < Test::Unit::TestCase "Original file got changed") assert_equal("file", File.lstat(link).ftype, "File is still a link") end + + def test_replace_links + dest = tempfile() + otherdest = tempfile() + link = tempfile() + + File.open(dest, "w") { |f| f.puts "boo" } + File.open(otherdest, "w") { |f| f.puts "yay" } + + obj = Puppet::Type.type(:file).create( + :path => link, + :ensure => otherdest + ) + + + assert_apply(obj) + + assert_equal(otherdest, File.readlink(link), "Link did not get created") + + obj[:ensure] = dest + + assert_apply(obj) + + assert_equal(dest, File.readlink(link), "Link did not get changed") + end end # $Id$ |
