From b85d3f32daaff3ce3f53c0b823a70a5a84a60482 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 29 Feb 2016 14:14:01 -0600 Subject: [PATCH] Add get_checksum option to win_stat to work with new use of the stat module for checksumming --- lib/ansible/modules/windows/win_stat.ps1 | 3 ++- lib/ansible/modules/windows/win_stat.py | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/windows/win_stat.ps1 b/lib/ansible/modules/windows/win_stat.ps1 index af9cbd7eca5..4b8f5f6ece5 100644 --- a/lib/ansible/modules/windows/win_stat.ps1 +++ b/lib/ansible/modules/windows/win_stat.ps1 @@ -31,6 +31,7 @@ If ($path -eq $FALSE) } $get_md5 = Get-Attr $params "get_md5" $TRUE | ConvertTo-Bool; +$get_checksum = Get-Attr $params "get_checksum" $TRUE | ConvertTo-Bool; $result = New-Object psobject @{ stat = New-Object psobject @@ -63,7 +64,7 @@ Else Set-Attr $result.stat "exists" $FALSE; } -If ($get_md5 -and $result.stat.exists -and -not $result.stat.isdir) +If (($get_checksum -or $get_md5) -and $result.stat.exists -and -not $result.stat.isdir) { $hash = Get-FileChecksum($path); Set-Attr $result.stat "md5" $hash; diff --git a/lib/ansible/modules/windows/win_stat.py b/lib/ansible/modules/windows/win_stat.py index a933384e20b..e26655985e2 100644 --- a/lib/ansible/modules/windows/win_stat.py +++ b/lib/ansible/modules/windows/win_stat.py @@ -34,10 +34,18 @@ options: aliases: [] get_md5: description: - - Whether to return the md5 sum of the file + - Whether to return the checksum sum of the file. As of Ansible 1.9 this + is no longer a MD5, but a SHA1 instead. required: false default: yes aliases: [] + get_checksum: + description: + - Whether to return a checksum of the file + (only sha1 currently supported) + required: false + default: yes + version_added: "2.1" author: "Chris Church (@cchurch)" '''