From 9d1bc151c7eb72c1281d6a22476a9082fef8374e Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 4 Jul 2017 16:24:22 +0100 Subject: checksum: Log failures --- src/virtBootstrap/sources.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/virtBootstrap/sources.py') diff --git a/src/virtBootstrap/sources.py b/src/virtBootstrap/sources.py index d1e9d55..b503846 100644 --- a/src/virtBootstrap/sources.py +++ b/src/virtBootstrap/sources.py @@ -56,8 +56,14 @@ def checksum(path, sum_type, sum_expected): handle.close() actual = algorithm(content).hexdigest() - return actual == sum_expected - except Exception: + if not actual == sum_expected: + logger.warning("File '%s' has invalid hash sum.\nExpected: %s\n" + "Actual: %s", path, sum_expected, actual) + return False + return True + except Exception as err: + logger.warning("Error occured while validating " + "the hash sum of file: %s\n%s", path, err) return False -- cgit