Remove wildcard imports and get_exception calls

Fixed module_utils
This commit is contained in:
Toshio Kuratomi 2017-08-11 20:23:17 -07:00
parent 93e1caccb7
commit ac56a2f138
15 changed files with 174 additions and 218 deletions

View file

@ -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