Skip to content

Commit 662fcaf

Browse files
author
luke
committed
making links even if the target does not exist
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1286 980ebf18-57e1-0310-9a29-db15c13687c0
1 parent 0ab461b commit 662fcaf

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

lib/puppet/type/pfile/ensure.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ module Puppet
8282
self.set_directory
8383
return :directory_created
8484
else
85-
state.mklink
86-
return :link_created
85+
return state.mklink
8786
end
8887
else
8988
self.fail "Cannot create a symlink without a target"

lib/puppet/type/pfile/target.rb

+8-15
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,24 @@ def mklink
2626

2727
case stat.ftype
2828
when "directory":
29-
# uh, bad stuff
30-
#self.fail "Not replacing directory"
3129
FileUtils.rmtree(@parent[:path])
3230
else
3331
File.unlink(@parent[:path])
3432
end
3533
end
3634
Dir.chdir(File.dirname(@parent[:path])) do
37-
unless FileTest.exists?(target)
38-
self.debug "Not linking to non-existent '%s'" % target
39-
:nochange # Grrr, can't return
40-
else
41-
Puppet::Util.asuser(@parent.asuser()) do
42-
mode = @parent.should(:mode)
43-
if mode
44-
Puppet::Util.withumask(000) do
45-
File.symlink(target, @parent[:path])
46-
end
47-
else
35+
Puppet::Util.asuser(@parent.asuser()) do
36+
mode = @parent.should(:mode)
37+
if mode
38+
Puppet::Util.withumask(000) do
4839
File.symlink(target, @parent[:path])
4940
end
41+
else
42+
File.symlink(target, @parent[:path])
5043
end
51-
52-
:link_created
5344
end
45+
46+
:link_created
5447
end
5548
end
5649

0 commit comments

Comments
 (0)