From d0a8005a7f64be444dd24adcd162efd808907da7 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman <rjeffman@redhat.com> Date: Wed, 12 Jul 2023 18:34:33 -0300 Subject: [PATCH] pylint: Disable broad exception warnings In recent pylint versions, use of broad exceptions for both raise and try/except blocks raise a linter warning. As its use is justifiable in the case of ipavault, the warnings are disabled where they occur. --- plugins/modules/ipavault.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/modules/ipavault.py b/plugins/modules/ipavault.py index b3a278c9..5a6dddb2 100644 --- a/plugins/modules/ipavault.py +++ b/plugins/modules/ipavault.py @@ -977,12 +977,14 @@ def main(): changed = 'Archived data into' in result['summary'] elif command == 'vault_retrieve': if 'result' not in result: + # pylint: disable=W0012,broad-exception-raised raise Exception("No result obtained.") if "data" in result["result"]: data_return = exit_args.setdefault("vault", {}) data_return["data"] = result["result"]["data"] else: if not datafile_out: + # pylint: disable=W0012,broad-exception-raised raise Exception("No data retrieved.") changed = False else: @@ -993,7 +995,7 @@ def main(): changed = True except ipalib_errors.EmptyModlist: result = {} - except Exception as exception: + except Exception as exception: # pylint: disable=broad-except ansible_module.fail_json( msg="%s: %s: %s" % (command, name, str(exception))) -- GitLab