From b1bac4d7cb56e0b06dda64dc8b3305d04768eb14 Mon Sep 17 00:00:00 2001 From: lhinds Date: Tue, 27 Jun 2017 21:12:06 +0100 Subject: Fixes UnboundLocalError issue. If no hash exists in the project exception file, then `return binary_hash` is Nonetype which throws an Unbound variable error. This change adds some dummy text to allow try / except statements to deal with missing entries in project exception files. JIRA: RELENG-264 Change-Id: I98fb4b01a2930b350794326d4cf735c8e014e00a Signed-off-by: lhinds --- anteater/src/get_lists.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'anteater/src/get_lists.py') diff --git a/anteater/src/get_lists.py b/anteater/src/get_lists.py index d7b0c47..b7b9aea 100644 --- a/anteater/src/get_lists.py +++ b/anteater/src/get_lists.py @@ -83,9 +83,13 @@ class GetLists(object): file_name = os.path.basename(patch_file) try: binary_hash = (yl['binaries'][project][file_name]) + return binary_hash except KeyError: - logger.error('Key Error processing binary hash values') - return binary_hash + logger.info('No checksum entries found for {0}'. + format(file_name)) + binary_hash = 'null' + return binary_hash + def file_audit_list(self, project): project_list = False -- cgit 1.2.3-korg