Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle no profile #217

Merged
merged 1 commit into from
Jun 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions abm/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down