mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 06:30:19 -07: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:
parent
587ab33415
commit
1d4ca0fd51
10 changed files with 36 additions and 92 deletions
|
@ -129,22 +129,10 @@ except ImportError:
|
|||
HAS_BOTO = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.ec2 import connect_to_aws, ec2_argument_spec, get_aws_connection_info
|
||||
from ansible.module_utils.ec2 import connect_to_aws, ec2_argument_spec, get_aws_connection_info, boto_exception
|
||||
from ansible.module_utils.six import string_types
|
||||
|
||||
|
||||
def boto_exception(err):
|
||||
'''generic error message handler'''
|
||||
if hasattr(err, 'error_message'):
|
||||
error = err.error_message
|
||||
elif hasattr(err, 'message'):
|
||||
error = err.message
|
||||
else:
|
||||
error = '%s: %s' % (Exception, err)
|
||||
|
||||
return error
|
||||
|
||||
|
||||
def user_action(module, iam, name, policy_name, skip, pdoc, state):
|
||||
policy_match = False
|
||||
changed = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue