I know this has been backed out of devel, but I need windows template 
support and it was so close to working for me that I decided to fix the few 
issues I found and keep using the branch I was on. In case this is useful 
for the future or for anyone else:

ansible/lib/ansible/module_utils/powershell.ps1: Get-FileChecksum needs an 
update from this:
[System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").
ToLower();
to this:
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", 
"").ToLower();

Otherwise it returns an array instead of a string, and win_copy will not be 
able to compare the two checksums correctly.


I also changed ansible/lib/ansible/modules/core/windows/win_copy.ps1 and 
updated:
$src_checksum.CompareTo($dest_checksum)
to:
$src_checksum.Equals($dest_checksum)
as apparently Microsoft recommends using CompareTo for sorting, not for 
checking equality, and I was getting some overload errors when CompareTo 
kept running into the array from Get-FileChecksum.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8ad48604-4f30-4144-9927-b31cbdc6877b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to