From 30b92a6f4cd92b69ae562d970efaf831858891e2 Mon Sep 17 00:00:00 2001 From: Jon Hawkesworth Date: Mon, 1 Jun 2015 21:53:49 +0100 Subject: [PATCH] Get-FileChecksum allways returns a string now, and the test_win_copy integration tests that depend on the checksum have been updated in this change too. --- lib/ansible/module_utils/powershell.ps1 | 2 +- test/integration/roles/test_win_copy/tasks/main.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/powershell.ps1 b/lib/ansible/module_utils/powershell.ps1 index 9606f47783..a11e316989 100644 --- a/lib/ansible/module_utils/powershell.ps1 +++ b/lib/ansible/module_utils/powershell.ps1 @@ -151,7 +151,7 @@ Function Get-FileChecksum($path) { $sp = new-object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider; $fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read); - [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower(); + $hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower(); $fp.Dispose(); } ElseIf (Test-Path -PathType Container $path) diff --git a/test/integration/roles/test_win_copy/tasks/main.yml b/test/integration/roles/test_win_copy/tasks/main.yml index d898219a85..48df427380 100644 --- a/test/integration/roles/test_win_copy/tasks/main.yml +++ b/test/integration/roles/test_win_copy/tasks/main.yml @@ -62,7 +62,7 @@ - name: verify that the file checksum is correct assert: that: - - "copy_result.checksum[0] == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'" + - "copy_result.checksum == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'" - name: check the stat results of the file win_stat: path={{output_file}} @@ -78,7 +78,7 @@ # - "stat_results.stat.isfifo == false" # - "stat_results.stat.isreg == true" # - "stat_results.stat.issock == false" - - "stat_results.stat.checksum[0] == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'" + - "stat_results.stat.checksum == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'" - name: overwrite the file via same means win_copy: src=foo.txt dest={{output_file}}