Skip to content

Commit

Permalink
Fix 'NoneType' object has no attribute 'get'
Browse files Browse the repository at this point in the history
There are situations where the action object returned by libjuju may not
have the 'results' attribute which leads to using the default value when
running ".get('results')" which it's None.

This change sets the default value to an empty dictionary to allow the
following ".get('Stdout', '')" succeed.
  • Loading branch information
freyes committed Mar 12, 2024
1 parent 40a5919 commit 66814f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zaza/openstack/utilities/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async def _check_ca_present(model, ca_files):
for unit in units:
try:
output = await unit.run('cat {}'.format(ca_file))
contents = output.data.get('results').get('Stdout', '')
contents = output.data.get('results', {}).get('Stdout', '')
if ca_cert not in contents:
break
# libjuju throws a generic error for connection failure. So we
Expand Down

0 comments on commit 66814f2

Please sign in to comment.