mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -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
|
@ -29,11 +29,9 @@
|
|||
|
||||
import os
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils.six.moves import configparser
|
||||
from ansible.module_utils.six import integer_types, string_types
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils._text import to_native, to_text
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
EXO_DNS_BASEURL = "https://api.exoscale.ch/dns/v1"
|
||||
|
@ -66,9 +64,8 @@ class ExoDns(object):
|
|||
config = self.read_config(ini_group=region)
|
||||
self.api_key = config['key']
|
||||
self.api_secret = config['secret']
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
self.module.fail_json(msg="Error while processing config: %s" % e)
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg="Error while processing config: %s" % to_native(e))
|
||||
|
||||
self.headers = {
|
||||
'X-DNS-Token': "%s:%s" % (self.api_key, self.api_secret),
|
||||
|
@ -133,9 +130,8 @@ class ExoDns(object):
|
|||
try:
|
||||
return self.module.from_json(to_text(response.read()))
|
||||
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
self.module.fail_json(msg="Could not process response into json: %s" % e)
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg="Could not process response into json: %s" % to_native(e))
|
||||
|
||||
def has_changed(self, want_dict, current_dict, only_keys=None):
|
||||
changed = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue