mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
amazon: extract copies of boto_exception to module_utils.ec2 (#20403)
* amazon: extract boto_exception to ec2 module This function was copy/pasted throughout several Amazon modules. This causes a consistency problem, since some improvements to message formatting were applied to some modules but not others. Now all modules use the same, improved function. * Rebase and make requested changes * Rebase and make requested changes
This commit is contained in:
@@ -245,22 +245,11 @@ except ImportError:
|
||||
|
||||
import ansible.module_utils.ec2
|
||||
# import a class, otherwise we'll use a fully qualified path
|
||||
from ansible.module_utils.ec2 import AWSRetry
|
||||
from ansible.module_utils.ec2 import AWSRetry, boto_exception
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_bytes
|
||||
|
||||
|
||||
def boto_exception(err):
|
||||
'''generic error message handler'''
|
||||
if hasattr(err, 'error_message'):
|
||||
error = err.error_message
|
||||
elif hasattr(err, 'message'):
|
||||
error = err.message + ' ' + str(err) + ' - ' + str(type(err))
|
||||
else:
|
||||
error = '%s: %s' % (Exception, err)
|
||||
|
||||
return error
|
||||
|
||||
|
||||
def get_stack_events(cfn, stack_name):
|
||||
'''This event data was never correct, it worked as a side effect. So the v2.3 format is different.'''
|
||||
|
||||
Reference in New Issue
Block a user