From dc5dc827064d22ac7b3f2a13ddeb2cd55467281d Mon Sep 17 00:00:00 2001 From: svarona Date: Mon, 1 Jul 2024 10:59:24 +0200 Subject: [PATCH] Fixed error because items can be none, empty list, or list with content --- bu_isciii/clean.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bu_isciii/clean.py b/bu_isciii/clean.py index cc514628..f1f14fc6 100644 --- a/bu_isciii/clean.py +++ b/bu_isciii/clean.py @@ -129,16 +129,16 @@ def get_clean_items(self, services_ids, type="files"): for service in services_ids: try: items = service_conf.get_find_deep(service, type) - if items: - for item in items: - if item not in clean_items_list: - clean_items_list.append(item) - else: + if items is None: stderr.print( "[red]ERROR: Service type %s not found in services json file for service %s." % (type, service) ) sys.exit() + else: + for item in items: + if item not in clean_items_list: + clean_items_list.append(item) except KeyError as e: stderr.print( "[red]ERROR: Service id %s not found in services json file."