From 7b8c916eb79a5fbf7b690e5435fe663ccc631164 Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Thu, 28 Jan 2021 12:13:39 -0700 Subject: [PATCH] mgr/cephadm: Do not use bare except, specify exception instead (E722) Signed-off-by: Michael Fritch (cherry picked from commit 9b0a3e623984605bbcbcd82d38a7ccb6106b1d2b) --- src/pybind/mgr/cephadm/upgrade.py | 2 +- src/pybind/mgr/orchestrator/module.py | 2 +- src/pybind/mgr/tox.ini | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/cephadm/upgrade.py b/src/pybind/mgr/cephadm/upgrade.py index 9518a6ea90e0e..00941f6a66780 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 28c862dc4f201..6b745076276cf 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 b9da10b32d717..f50f59399da0a 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, -- 2.39.5