Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10192 from tpapaioa/fix_miq_conf_credential
Browse files Browse the repository at this point in the history
[1LP][RFR] [NOTEST] Fix KeyError in show-credential script
  • Loading branch information
jawatts authored Jun 16, 2020
2 parents aec99a8 + 2fa50e3 commit a324672
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cfme/scripting/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ def show_credential(cred_or_provider_key, only_credentials):
endpoints_data = data['management_systems'][cred_or_provider_key].get('endpoints', {})
for endpoint in endpoints_data:
print(endpoint)
cred_key = endpoints_data[endpoint]['credentials']
cred_key = endpoints_data[endpoint].get('credentials')
if not cred_key:
print(" No credentials defined for this endpoint.")
continue
cred_dict = conf.credentials[cred_key]
for k in cred_dict:
print(" {}: {}".format(k, cred_dict[k]))
for k, v in cred_dict.items():
print(f" {k}: {v}")
elif cred_or_provider_key in conf.credentials:
cred_dict = conf.credentials[cred_or_provider_key]
for k in cred_dict:
print("{}: {}".format(k, cred_dict[k]))
for k, v in cred_dict.items():
print(f"{k}: {v}")
else:
print("Key couldn't be found in providers or credentials YAMLS")

Expand Down

0 comments on commit a324672

Please sign in to comment.