From 31ad27bfde3fbc305968a37663e79a8e776c232e Mon Sep 17 00:00:00 2001 From: Keith Suderman Date: Mon, 12 Jun 2023 20:11:54 -0400 Subject: [PATCH] Return an empty dictionary instead of None --- abm/lib/common.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/abm/lib/common.py b/abm/lib/common.py index aba1ab8..03d7812 100644 --- a/abm/lib/common.py +++ b/abm/lib/common.py @@ -95,7 +95,7 @@ def load_profiles(): :return: a dictionary containing the YAML content of the configuration. ''' yaml = get_yaml_parser() - profiles = None + profiles = {} for profile_path in PROFILE_SEARCH_PATH: profile_path = os.path.expanduser(profile_path) if os.path.exists(profile_path): @@ -131,8 +131,9 @@ def parse_profile(profile_name: str): if profile_name not in profiles: print(f'ERROR: {profile_name} is not the name of a valid profile.') keys = list(profiles.keys()) - quoted_keys = ', '.join([f"'{k}'" for k in keys[0:-2]]) + f", and '{keys[-1]}'" - print(f'The defined profile names are: {quoted_keys}') + if len(keys) > 0: + quoted_keys = ', '.join([f"'{k}'" for k in keys[0:-2]]) + f", and '{keys[-1]}'" + print(f'The defined profile names are: {quoted_keys}') return None, None, None profile = profiles[profile_name] if 'kube' in profile: