Fix non existing attribuites in SDK exception

SDK exception may not have extra_data, details or
response attributes. Print None in this case.

Change-Id: Ic4073c28a4e4afb8ca5d2b72c4ea8582da244af1
This commit is contained in:
Sagi Shnaidman
2020-08-11 14:17:25 +03:00
parent 86a5cc3b42
commit 03fadf3b43

View File

@@ -392,9 +392,10 @@ class OpenStackModule:
params = {
'msg': str(e),
'extra_data': {
'data': e.extra_data,
'details': e.details,
'response': e.response.text
'data': getattr(e, 'extra_data', 'None'),
'details': getattr(e, 'details', 'None'),
'response': getattr(getattr(e, 'response', ''),
'text', 'None')
}
}
self.ansible.fail_json(**params)