diff options
author | SteveLowe <slowe@slnet.eu> | 2015-03-12 07:51:43 +0000 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-06-02 14:17:12 -0700 |
commit | 1b3e3c8e3a743187abe7dfe593a04df1df29174c (patch) | |
tree | c120e59ee2f65094cd0c22c5d7bf7d2301ea81d8 /lib/chef/file_content_management | |
parent | d8172e646d9fbf43e57bca5e20d0ac352ba9a66a (diff) | |
download | chef-1b3e3c8e3a743187abe7dfe593a04df1df29174c.tar.gz |
Fix copying ntfs dacl and sacl when nulljdm/3066
Fixes #1992
Diffstat (limited to 'lib/chef/file_content_management')
-rw-r--r-- | lib/chef/file_content_management/deploy/mv_windows.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/chef/file_content_management/deploy/mv_windows.rb b/lib/chef/file_content_management/deploy/mv_windows.rb index 7504123012..0d16da9717 100644 --- a/lib/chef/file_content_management/deploy/mv_windows.rb +++ b/lib/chef/file_content_management/deploy/mv_windows.rb @@ -63,12 +63,22 @@ class Chef raise Chef::Exceptions::WindowsNotAdmin, "can not get the security information for '#{dst}' due to missing Administrator privileges." end - if dst_sd.dacl_present? - apply_dacl = ACL.create(dst_sd.dacl.select { |ace| !ace.inherited? }) + dacl_present = dst_sd.dacl_present? + if dacl_present + if dst_sd.dacl.nil? + apply_dacl = nil + else + apply_dacl = ACL.create(dst_sd.dacl.select { |ace| !ace.inherited? }) + end end - if dst_sd.sacl_present? - apply_sacl = ACL.create(dst_sd.sacl.select { |ace| !ace.inherited? }) + sacl_present = dst_sd.sacl_present? + if sacl_present + if dst_sd.sacl.nil? + apply_sacl = nil + else + apply_sacl = ACL.create(dst_sd.sacl.select { |ace| !ace.inherited? }) + end end # @@ -84,8 +94,8 @@ class Chef dst_so = Security::SecurableObject.new(dst) dst_so.group = dst_sd.group dst_so.owner = dst_sd.owner - dst_so.set_dacl(apply_dacl, dst_sd.dacl_inherits?) if dst_sd.dacl_present? - dst_so.set_sacl(apply_sacl, dst_sd.sacl_inherits?) if dst_sd.sacl_present? + dst_so.set_dacl(apply_dacl, dst_sd.dacl_inherits?) if dacl_present + dst_so.set_sacl(apply_sacl, dst_sd.sacl_inherits?) if sacl_present end end |