diff options
author | jmink <jmink@getchef.com> | 2014-07-09 16:58:41 -0400 |
---|---|---|
committer | jmink <jmink@getchef.com> | 2014-07-15 10:32:17 -0400 |
commit | 5732bcc7c61ff22449dca1d21b39b0d3f833a320 (patch) | |
tree | 882ef063583d8f94f847ebb29d8c95641fa10599 /lib/chef/provider/link.rb | |
parent | 34afb948d6372bc0cfac6ce1e30e3e0bc4f02c72 (diff) | |
download | chef-5732bcc7c61ff22449dca1d21b39b0d3f833a320.tar.gz |
Limit change to windows and fix test to be accurate.
Diffstat (limited to 'lib/chef/provider/link.rb')
-rw-r--r-- | lib/chef/provider/link.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/provider/link.rb b/lib/chef/provider/link.rb index af7923fcad..c41fbcad95 100644 --- a/lib/chef/provider/link.rb +++ b/lib/chef/provider/link.rb @@ -98,19 +98,19 @@ class Chef @current_resource.link_type != @new_resource.link_type # Handle the case where the symlink already exists and is pointing at a valid to_file if @current_resource.to - # On windows, to fix a symlink already pointing at a directory we must first + # On Windows, to fix a symlink already pointing at a directory we must first # ::Dir.unlink the symlink (not the directory), while if we have a symlink # pointing at file we must use ::File.unlink on the symlink. # However if the new symlink will point to a file and the current symlink is pointing at a # directory we want to throw an exception and calling ::File.unlink on the directory symlink # will throw the correct ones. - if ::File.directory?(@new_resource.to) && + if Chef::Platform.windows? && ::File.directory?(@new_resource.to) && ::File.directory?(@current_resource.target_file) - converge_by("unlink existing dir at #{@new_resource.target_file}") do + converge_by("unlink existing windows symlink to dir at #{@new_resource.target_file}") do ::Dir.unlink(@new_resource.target_file) end else - converge_by("unlink existing file at #{@new_resource.target_file}") do + converge_by("unlink existing symlink to file at #{@new_resource.target_file}") do ::File.unlink(@new_resource.target_file) end end |