From 2c39eff60e084b88af92e5e7ed5b198ac365df39 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Tue, 6 May 2014 18:27:43 +0200 Subject: [PATCH] [get_url] check against lowered stripped sha256sum The content of the sha256sum attribute should be lowered before comparing it with the calculated sha256sum. In the following example the used sha256sum uses ABC.. and not abc.. and the check failed. This should not happen. ``` TASK: [get_url url=http://ftp.fau.de/apache/hadoop/common/hadoop-2.4.0/hadoop-2.4.0.tar.gz dest=/home/vagrant/hadoop-2.4.0.tar.gz mode=0644 sha256sum=024326AC68A1A68B5566B10F95609EAAFD9F70CFEB37FCA0E97CBB1674E57C3A] *** failed: [instance000] => {"failed": true} msg: The SHA-256 checksum for /home/vagrant/hadoop-2.4.0.tar.gz did not match 024326AC68A1A68B5566B10F95609EAAFD9F70CFEB37FCA0E97CBB1674E57C3A; it was 024326ac68a1a68b5566b10f95609eaafd9f70cfeb37fca0e97cbb1674e57c3a. FATAL: all hosts have already failed -- aborting ``` --- library/network/get_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/network/get_url b/library/network/get_url index e1ff8d24d7..132c8553eb 100644 --- a/library/network/get_url +++ b/library/network/get_url @@ -283,7 +283,7 @@ def main(): else: destination_checksum = module.sha256(dest) - if stripped_sha256sum != destination_checksum: + if stripped_sha256sum.lower() != destination_checksum: os.remove(dest) module.fail_json(msg="The SHA-256 checksum for %s did not match %s; it was %s." % (dest, sha256sum, destination_checksum))