From b1201da8b137e836e864dfb96fc4e415d7022004 Mon Sep 17 00:00:00 2001 From: Adrian Chifor Date: Thu, 22 Mar 2018 17:33:32 +0000 Subject: [PATCH] Raise exceptions instead of returning --- kapitan/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kapitan/utils.py b/kapitan/utils.py index e295caf5b..146ab51e3 100644 --- a/kapitan/utils.py +++ b/kapitan/utils.py @@ -213,6 +213,7 @@ def deep_get(x, keys): for i in output: print('{0!s:{l}} {1!s}'.format(*i, l=maxlenght + 2)) + def get_directory_hash(directory): ''' Compute a sha256 hash for the file contents of a directory @@ -231,10 +232,10 @@ def get_directory_hash(directory): hash.update(sha256(f.read().encode("UTF-8")).hexdigest().encode("UTF-8")) except Exception as e: logger.error("utils.get_directory_hash failed to open %s: %s", file_path, str(e)) - return -2 + raise except Exception as e: logger.error("utils.get_directory_hash failed: %s", str(e)) - return -2 + raise return hash.hexdigest()