Fix undefined variables, basestring usage, and some associated python3 issues

This commit is contained in:
Toshio Kuratomi
2017-07-22 18:15:46 -07:00
parent 9f7b0dfc30
commit 225fa5d092
84 changed files with 652 additions and 963 deletions

View File

@@ -100,13 +100,14 @@ msg:
import json
import logging
import sys
import traceback
from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
from ansible.module_utils.urls import open_url
from ansible.module_utils.six.moves import reduce
from ansible.module_utils.six.moves.urllib.error import HTTPError
from ansible.module_utils._text import to_native
from ansible.module_utils.urls import open_url
def request(url, data=None, headers=None, method='GET', use_proxy=True,
@@ -117,8 +118,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs,
url_username=url_username, url_password=url_password, http_agent=http_agent,
force_basic_auth=force_basic_auth)
except HTTPError:
err = get_exception()
except HTTPError as err:
r = err.fp
try:
@@ -414,10 +414,11 @@ def main():
sp = NetAppESeriesFlashCache()
try:
sp.apply()
except Exception:
e = get_exception()
sp.debug("Exception in apply(): \n%s" % str(e))
sp.module.fail_json(msg="Failed to create flash cache. Error[%s]" % str(e))
except Exception as e:
sp.debug("Exception in apply(): \n%s" % to_native(e))
sp.module.fail_json(msg="Failed to create flash cache. Error[%s]" % to_native(e),
exception=traceback.format_exc())
if __name__ == '__main__':
main()