mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-30 04:49:09 -07:00
Remove wildcard imports and get_exception calls
Fixed module_utils
This commit is contained in:
parent
93e1caccb7
commit
ac56a2f138
15 changed files with 174 additions and 218 deletions
|
@ -32,12 +32,12 @@ This module adds shared support for Apstra AOS modules
|
|||
|
||||
In order to use this module, include it as part of your module
|
||||
|
||||
from ansible.module_utils.aos import *
|
||||
from ansible.module_utils.aos import (check_aos_version, get_aos_session, find_collection_item,
|
||||
content_to_dict, do_load_resource)
|
||||
|
||||
"""
|
||||
import json
|
||||
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
try:
|
||||
|
@ -53,6 +53,8 @@ try:
|
|||
except ImportError:
|
||||
HAS_AOS_PYEZ = False
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
def check_aos_version(module, min=False):
|
||||
"""
|
||||
|
@ -172,8 +174,7 @@ def do_load_resource(module, collection, name):
|
|||
try:
|
||||
item.datum = module.params['content']
|
||||
item.write()
|
||||
except:
|
||||
e = get_exception()
|
||||
module.fail_json(msg="Unable to write item content : %r" % e)
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Unable to write item content : %r" % to_native(e))
|
||||
|
||||
module.exit_json(changed=True, name=item.name, id=item.id, value=item.value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue