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: v16.2.0~178^2~38 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b8c916eb79a5fbf7b690e5435fe663ccc631164;p=ceph.git mgr/cephadm: Do not use bare except, specify exception instead (E722) Signed-off-by: Michael Fritch (cherry picked from commit 9b0a3e623984605bbcbcd82d38a7ccb6106b1d2b) --- diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index 9518a6ea90e0..00941f6a6678 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 28c862dc4f20..6b745076276c 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 b9da10b32d71..f50f59399da0 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,