diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-21 17:22:26 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-21 17:22:26 +0000 |
commit | 5faa45d328e183c84754692b2a3837a09a190437 (patch) | |
tree | ab38bbd1caad45899d29caa93e9d243f812c4a9d | |
parent | 62abbd5d3f4d7f9ec0f1781ee8247c8942a34a0f (diff) | |
download | puppet-5faa45d328e183c84754692b2a3837a09a190437.tar.gz puppet-5faa45d328e183c84754692b2a3837a09a190437.tar.xz puppet-5faa45d328e183c84754692b2a3837a09a190437.zip |
Fixing #274. I just set :ensure to be :link when :target is set.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1644 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/type/pfile/target.rb | 6 | ||||
-rw-r--r-- | test/types/file.rb | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/puppet/type/pfile/target.rb b/lib/puppet/type/pfile/target.rb index 4a725d652..23fb30390 100644 --- a/lib/puppet/type/pfile/target.rb +++ b/lib/puppet/type/pfile/target.rb @@ -12,6 +12,12 @@ module Puppet # Anything else, basically newvalue(/./) do + if ! @parent.should(:ensure) + @parent[:ensure] = :link + elsif @parent.should(:ensure) != :link + raise Puppet::Error, + "You cannot specify a target unless 'ensure' is set to 'link'" + end if @parent.state(:ensure).insync? mklink() end diff --git a/test/types/file.rb b/test/types/file.rb index b87f1b928..d2c593c8b 100644 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -1406,6 +1406,20 @@ class TestFile < Test::Unit::TestCase assert(FileTest.exists?(localfile), "File got purged") assert(! FileTest.exists?(randfile), "File did not get purged") end + + # Testing #274. Make sure target can be used without 'ensure'. + def test_target_without_ensure + source = tempfile() + dest = tempfile() + File.open(source, "w") { |f| f.puts "funtest" } + + obj = nil + assert_nothing_raised { + obj = Puppet::Type.newfile(:path => dest, :target => source) + } + + assert_apply(obj) + end end # $Id$ |