1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Bugfix: bulletproof unexpected_error_msg at gce.py

This method was still failing for me with a "missing http_code" message. After applying this change, the error message is:

```
msg: Unexpected response: {'value': 'PyCrypto library required for Service Account Authentication.'}
```

I wanted to contribute a rock-solid `unexpected_error_msg` implementation.
This commit is contained in:
Nacho Coloma 2014-07-23 16:45:24 +02:00
parent d2a130971a
commit 57428c48a2

View file

@ -64,7 +64,5 @@ def gce_connect(module):
def unexpected_error_msg(error):
"""Create an error string based on passed in error."""
msg='Unexpected response: HTTP return_code['
msg+='%s], API error code[%s] and message: %s' % (
error.http_code, error.code, str(error.value))
return msg
import pprint
return 'Unexpected response: ' + pprint.pformat(vars(error))