From 2639d4c023fc31c93a25ba5456df70acac7a335f Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 17 Apr 2020 11:54:34 +0530 Subject: [PATCH] maven_artifact: Convert MD5 values to lowercase before comparison (#197) Fixes: ansible-collections/community.general#186 Signed-off-by: Abhijeet Kasurde --- changelogs/fragments/186-maven_artifact.yml | 2 ++ plugins/modules/packaging/language/maven_artifact.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/186-maven_artifact.yml diff --git a/changelogs/fragments/186-maven_artifact.yml b/changelogs/fragments/186-maven_artifact.yml new file mode 100644 index 0000000000..17b84bc6c5 --- /dev/null +++ b/changelogs/fragments/186-maven_artifact.yml @@ -0,0 +1,2 @@ +bugfixes: +- Convert MD5SUM to lowercase before comparison in maven_artifact module (https://github.com/ansible-collections/community.general/issues/186). diff --git a/plugins/modules/packaging/language/maven_artifact.py b/plugins/modules/packaging/language/maven_artifact.py index f1b5e2f3d3..30de44d3a7 100644 --- a/plugins/modules/packaging/language/maven_artifact.py +++ b/plugins/modules/packaging/language/maven_artifact.py @@ -519,12 +519,12 @@ class MavenDownloader: remote_md5 = _remote_md5 # remote_md5 is empty so we continue and keep original md5 string # This should not happen since we check for remote_md5 before - except IndexError as e: + except IndexError: pass - if local_md5 == remote_md5: + if local_md5.lower() == remote_md5.lower(): return None else: - return "Checksum does not match: we computed " + local_md5 + "but the repository states " + remote_md5 + return "Checksum does not match: we computed " + local_md5 + " but the repository states " + remote_md5 return "Path does not exist: " + file