From 250d5b74fa0f9ec7a2e35848572a0ea9f4f8d9ee Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Tue, 24 Apr 2018 12:46:40 +1000 Subject: [PATCH] Fix for win_get_url module (Fixes #39151) - 2.5 backport (#39207) * Fix for win_get_url module (#39152) (cherry picked from commit 0c96863ec68b8b559bbc07cb3952f1cbaf4287c6) * Added changelog fragment --- changelogs/fragments/win_get_url_fix_timestamp_comparison.yaml | 2 ++ lib/ansible/modules/windows/win_get_url.ps1 | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/win_get_url_fix_timestamp_comparison.yaml diff --git a/changelogs/fragments/win_get_url_fix_timestamp_comparison.yaml b/changelogs/fragments/win_get_url_fix_timestamp_comparison.yaml new file mode 100644 index 00000000000000..89bea175972ed0 --- /dev/null +++ b/changelogs/fragments/win_get_url_fix_timestamp_comparison.yaml @@ -0,0 +1,2 @@ +bugfixes: +- win_get_url - Compare the UTC time of the web file to the local UTC time (https://github.com/ansible/ansible/pull/39152) diff --git a/lib/ansible/modules/windows/win_get_url.ps1 b/lib/ansible/modules/windows/win_get_url.ps1 index 7047f8a7dad403..1cf4ef5d0fba09 100644 --- a/lib/ansible/modules/windows/win_get_url.ps1 +++ b/lib/ansible/modules/windows/win_get_url.ps1 @@ -71,7 +71,7 @@ Function CheckModified-File($url, $dest, $headers, $credentials, $timeout, $use_ $result.msg = $webResponse.StatusDescription $webResponse.Close() - if ($webLastMod -and ((Get-Date -Date $webLastMod) -lt $fileLastMod)) { + if ($webLastMod -and ((Get-Date -Date $webLastMod).ToUniversalTime() -lt $fileLastMod)) { return $false } else { return $true