summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliasgar16 <aliasgar.batterywala@clogeny.com>2016-08-23 19:55:52 +0530
committeraliasgar16 <aliasgar.batterywala@clogeny.com>2016-08-23 19:55:52 +0530
commit719718f35169670bd79be8cd595bdf0fe4b0e221 (patch)
treea313e43db64a5a6ef23c3d7823d1fe2626b6ef6e
parentdca6734d9c22953f80f3fd8b13e16f8a141f2a36 (diff)
downloadchef-719718f35169670bd79be8cd595bdf0fe4b0e221.tar.gz
Added code to handle deletion of directories on Windows that are symlinks.
-rw-r--r--lib/chef/provider/link.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/chef/provider/link.rb b/lib/chef/provider/link.rb
index 5fce97e5b3..16d30319b3 100644
--- a/lib/chef/provider/link.rb
+++ b/lib/chef/provider/link.rb
@@ -141,9 +141,16 @@ class Chef
def action_delete
if @current_resource.to # Exists
- converge_by("delete link at #{@new_resource.target_file}") do
- ::File.delete(@new_resource.target_file)
- Chef::Log.info("#{@new_resource} deleted")
+ if Chef::Platform.windows? && ::File.directory?(@current_resource.target_file)
+ converge_by("delete link to dir at #{@new_resource.target_file}") do
+ ::Dir.delete(@new_resource.target_file)
+ Chef::Log.info("#{@new_resource} deleted")
+ end
+ else
+ converge_by("delete link to file at #{@new_resource.target_file}") do
+ ::File.delete(@new_resource.target_file)
+ Chef::Log.info("#{@new_resource} deleted")
+ end
end
end
end