From: Michael Fritch Date: Thu, 28 Jan 2021 19:13:39 +0000 (-0700) Subject: mgr/cephadm: Do not use bare except, specify exception instead (E722) X-Git-Tag: v17.1.0~3027^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9b0a3e623984605bbcbcd82d38a7ccb6106b1d2b;p=ceph.git mgr/cephadm: Do not use bare except, specify exception instead (E722) Signed-off-by: Michael Fritch --- diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index 9518a6ea90e..00941f6a667 100644 --- a/src/pybind/mgr/cephadm/upgrade.py +++ b/src/pybind/mgr/cephadm/upgrade.py @@ -103,7 +103,7 @@ class CephadmUpgrade: (major, minor, patch) = version.split('.') assert int(minor) >= 0 # patch might be a number or {number}-g{sha1} - except: + except ValueError: return 'version must be in the form X.Y.Z (e.g., 15.2.3)' if int(major) < 15 or (int(major) == 15 and int(minor) < 2): return 'cephadm only supports octopus (15.2.0) or later' diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 54122d4029a..bb62e57da09 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -284,7 +284,7 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, self._refresh_health() return HandleCommandResult(stdout=str(completion.result)) - except: + except Exception: # There are several reasons the try: block might fail: # 1. the device no longer exist # 2. the device is no longer known to Ceph diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 109bb26964c..a56035cc849 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -12,7 +12,6 @@ requires = cython max-line-length = 100 ignore = E501, - E722, E731, E741, F401,