diff options
Diffstat (limited to 'lib/ansible/module_utils/network')
-rw-r--r-- | lib/ansible/module_utils/network/a10/a10.py | 4 | ||||
-rw-r--r-- | lib/ansible/module_utils/network/aci/aci.py | 6 | ||||
-rw-r--r-- | lib/ansible/module_utils/network/aci/msc.py | 2 | ||||
-rw-r--r-- | lib/ansible/module_utils/network/aos/aos.py | 4 | ||||
-rw-r--r-- | lib/ansible/module_utils/network/cnos/cnos.py | 6 | ||||
-rw-r--r-- | lib/ansible/module_utils/network/common/utils.py | 2 | ||||
-rw-r--r-- | lib/ansible/module_utils/network/fortios/fortios.py | 4 | ||||
-rw-r--r-- | lib/ansible/module_utils/network/meraki/meraki.py | 2 |
8 files changed, 15 insertions, 15 deletions
diff --git a/lib/ansible/module_utils/network/a10/a10.py b/lib/ansible/module_utils/network/a10/a10.py index 1a1b9f9d81..bf713702e4 100644 --- a/lib/ansible/module_utils/network/a10/a10.py +++ b/lib/ansible/module_utils/network/a10/a10.py @@ -78,7 +78,7 @@ def axapi_call(module, url, post=None): data = {"response": {"status": "OK"}} else: data = {"response": {"status": "fail", "err": {"msg": raw_data}}} - except: + except Exception: module.fail_json(msg="could not read the result from the host") finally: rsp.close() @@ -126,7 +126,7 @@ def axapi_call_v3(module, url, method=None, body=None, signature=None): data = {"response": {"status": "OK"}} else: data = {"response": {"status": "fail", "err": {"msg": raw_data}}} - except: + except Exception: module.fail_json(msg="could not read the result from the host") finally: rsp.close() diff --git a/lib/ansible/module_utils/network/aci/aci.py b/lib/ansible/module_utils/network/aci/aci.py index 4e8d9df3ad..4c82ccf281 100644 --- a/lib/ansible/module_utils/network/aci/aci.py +++ b/lib/ansible/module_utils/network/aci/aci.py @@ -148,7 +148,7 @@ class ACIModule(object): return true elif bool_value is False: return false - except: + except Exception: # This provides backward compatibility to Ansible v2.4, deprecate in Ansible v2.8 if value == true: self.module.deprecate("Boolean value '%s' is no longer valid, please use 'yes' as a boolean value." % value, '2.9') @@ -164,7 +164,7 @@ class ACIModule(object): ''' Return an ACI-compatible ISO8601 formatted time: 2123-12-12T00:00:00.000+00:00 ''' try: return dt.isoformat(timespec='milliseconds') - except: + except Exception: tz = dt.strftime('%z') return '%s.%03d%s:%s' % (dt.strftime('%Y-%m-%dT%H:%M:%S'), dt.microsecond / 1000, tz[:3], tz[3:]) @@ -231,7 +231,7 @@ class ACIModule(object): try: sig_key = load_privatekey(FILETYPE_PEM, open(self.params['private_key'], 'r').read()) - except: + except Exception: self.module.fail_json(msg='Cannot load private key %s' % self.params['private_key']) # NOTE: ACI documentation incorrectly adds a space between method and path diff --git a/lib/ansible/module_utils/network/aci/msc.py b/lib/ansible/module_utils/network/aci/msc.py index c7b0a61363..6c8ede9586 100644 --- a/lib/ansible/module_utils/network/aci/msc.py +++ b/lib/ansible/module_utils/network/aci/msc.py @@ -183,7 +183,7 @@ class MSCModule(object): elif self.status >= 400: try: payload = json.loads(resp.read()) - except: + except Exception: payload = json.loads(info['body']) if 'code' in payload: self.fail_json(msg='MSC Error {code}: {message}'.format(**payload), data=data, info=info, payload=payload) diff --git a/lib/ansible/module_utils/network/aos/aos.py b/lib/ansible/module_utils/network/aos/aos.py index 89074e8acf..092bbf5b4a 100644 --- a/lib/ansible/module_utils/network/aos/aos.py +++ b/lib/ansible/module_utils/network/aos/aos.py @@ -147,7 +147,7 @@ def content_to_dict(module, content): if not content_dict: raise Exception() - except: + except Exception: module.fail_json(msg="Unable to convert 'content' to a dict, please check if valid") # replace the string with the dict @@ -163,7 +163,7 @@ def do_load_resource(module, collection, name): try: item = find_collection_item(collection, name, '') - except: + except Exception: module.fail_json(msg="An error occurred while running 'find_collection_item'") if item.exists: diff --git a/lib/ansible/module_utils/network/cnos/cnos.py b/lib/ansible/module_utils/network/cnos/cnos.py index ea104c8f94..f3ca8cbef3 100644 --- a/lib/ansible/module_utils/network/cnos/cnos.py +++ b/lib/ansible/module_utils/network/cnos/cnos.py @@ -38,7 +38,7 @@ try: from ansible.module_utils.network.cnos import cnos_errorcodes from ansible.module_utils.network.cnos import cnos_devicerules HAS_LIB = True -except: +except Exception: HAS_LIB = False from distutils.cmd import Command from ansible.module_utils._text import to_text @@ -1372,7 +1372,7 @@ def enterEnableModeForDevice(enablePassword, timeout, obj): gotit = buff.find("#") if(gotit != -1): return retVal - except: + except Exception: retVal = retVal + "\n Error-101" flag = True if(retVal == ""): @@ -1396,7 +1396,7 @@ def waitForDeviceResponse(command, prompt, timeout, obj): gotit = buff.find(prompt) if(gotit != -1): flag = True - except: + except Exception: # debugOutput(prompt) if prompt == "(yes/no)?": retVal = retVal diff --git a/lib/ansible/module_utils/network/common/utils.py b/lib/ansible/module_utils/network/common/utils.py index 20bb5c4bae..927c2f5fdb 100644 --- a/lib/ansible/module_utils/network/common/utils.py +++ b/lib/ansible/module_utils/network/common/utils.py @@ -461,7 +461,7 @@ class Template: if value: try: return ast.literal_eval(value) - except: + except Exception: return str(value) else: return None diff --git a/lib/ansible/module_utils/network/fortios/fortios.py b/lib/ansible/module_utils/network/fortios/fortios.py index 1d69cbebb4..bf3385aa31 100644 --- a/lib/ansible/module_utils/network/fortios/fortios.py +++ b/lib/ansible/module_utils/network/fortios/fortios.py @@ -79,7 +79,7 @@ def backup(module, running_config): if not os.path.exists(backup_path): try: os.mkdir(backup_path) - except: + except Exception: module.fail_json(msg="Can't create directory {0} Permission denied ?".format(backup_path)) tstamp = time.strftime("%Y-%m-%d@%H:%M:%S", time.localtime(time.time())) if 0 < len(backup_filename): @@ -88,7 +88,7 @@ def backup(module, running_config): filename = '%s/%s_config.%s' % (backup_path, module.params['host'], tstamp) try: open(filename, 'w').write(running_config) - except: + except Exception: module.fail_json(msg="Can't create backup file {0} Permission denied ?".format(filename)) diff --git a/lib/ansible/module_utils/network/meraki/meraki.py b/lib/ansible/module_utils/network/meraki/meraki.py index 4519f87a3f..f73b636239 100644 --- a/lib/ansible/module_utils/network/meraki/meraki.py +++ b/lib/ansible/module_utils/network/meraki/meraki.py @@ -292,7 +292,7 @@ class MerakiModule(object): body=json.loads(to_native(info['body']))) try: return json.loads(to_native(resp.read())) - except: + except Exception: pass def exit_json(self, **kwargs): |