From 186d739d7f54989e9ed6ea08371825b29f21b811 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: May 05 2020 08:42:46 +0000 Subject: Fix E722 do not use bare 'except' Related: https://pagure.io/freeipa/issue/8306 Signed-off-by: Christian Heimes Reviewed-By: Florence Blanc-Renaud --- diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index 7bb0415..64aaad1 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -538,7 +538,7 @@ def run(args, stdin=None, raiseonerr=True, nolog=(), env=None, logger.debug('Process interrupted') p.wait() raise - except: + except BaseException: logger.debug('Process execution failed') raise finally: diff --git a/ipaserver/install/ipa_kra_install.py b/ipaserver/install/ipa_kra_install.py index 2d6e4bf..159f02e 100644 --- a/ipaserver/install/ipa_kra_install.py +++ b/ipaserver/install/ipa_kra_install.py @@ -216,7 +216,7 @@ class KRAInstaller(KRAInstall): try: kra.install(api, config, self.options, custodia=custodia) - except: + except BaseException: logger.error('%s', dedent(self.FAIL_MESSAGE)) raise diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py index cf05bb4..3706bdd 100644 --- a/ipaserver/install/service.py +++ b/ipaserver/install/service.py @@ -159,7 +159,7 @@ def set_service_entry_config(name, fqdn, config_values, "service %s has already enabled config values %s", name, config_values) return - except: + except BaseException: logger.debug("failed to set service %s config values", name) raise @@ -699,7 +699,7 @@ class Service: api.Backend.ldap2.update_entry(entry) except errors.EmptyModlist: pass - except: + except BaseException: logger.debug("failed to disable service %s startup entry", name) raise diff --git a/ipaserver/plugins/certprofile.py b/ipaserver/plugins/certprofile.py index 6e2e91d..ffede6e 100644 --- a/ipaserver/plugins/certprofile.py +++ b/ipaserver/plugins/certprofile.py @@ -268,7 +268,7 @@ class certprofile_import(LDAPCreate): with self.api.Backend.ra_certprofile as profile_api: profile_api.create_profile(context.profile) profile_api.enable_profile(keys[0]) - except: + except BaseException: # something went wrong ; delete entry ldap.delete_entry(dn) raise diff --git a/ipaserver/plugins/stageuser.py b/ipaserver/plugins/stageuser.py index e56a1bb..2c35a8e 100644 --- a/ipaserver/plugins/stageuser.py +++ b/ipaserver/plugins/stageuser.py @@ -720,7 +720,7 @@ class stageuser_activate(LDAPQuery): # Now delete the Staging entry try: self._exc_wrapper(args, options, ldap.delete_entry)(staging_dn) - except: + except BaseException: try: logger.error("Fail to delete the Staging user after " "activating it %s ", staging_dn)