From 9ba30d2cea6c89021b19545572272569f0cef135 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Kliemeck Date: Mon, 26 Oct 2015 10:20:14 +0100 Subject: [PATCH] only call set-acl if necessary --- lib/ansible/modules/extras/windows/win_owner.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/extras/windows/win_owner.ps1 b/lib/ansible/modules/extras/windows/win_owner.ps1 index eb69e744e6..0623f2b17a 100644 --- a/lib/ansible/modules/extras/windows/win_owner.ps1 +++ b/lib/ansible/modules/extras/windows/win_owner.ps1 @@ -111,23 +111,23 @@ Try { $acl = Get-Acl $file.FullName If ($acl.getOwner([System.Security.Principal.SecurityIdentifier]) -ne $objUser) { + $acl.setOwner($objUser) + Set-Acl $file.FullName $acl + Set-Attr $result "changed" $true; } - $acl.setOwner($objUser) - Set-Acl $file.FullName $acl - If ($recurse) { $files = Get-ChildItem -Path $path -Force -Recurse ForEach($file in $files){ $acl = Get-Acl $file.FullName If ($acl.getOwner([System.Security.Principal.SecurityIdentifier]) -ne $objUser) { + $acl.setOwner($objUser) + Set-Acl $file.FullName $acl + Set-Attr $result "changed" $true; } - - $acl.setOwner($objUser) - Set-Acl $file.FullName $acl } } }