Skip to content

Commit 96b9564

Browse files
pybind/mgr: add a specific exception for the mgr_pool disabled case
This can help avoid confusion when debugging why the mgr_pool was not available. Signed-off-by: John Mulligan <[email protected]>
1 parent f9c962a commit 96b9564

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/pybind/mgr/mgr_module.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ class MgrDBNotReady(RuntimeError):
191191
pass
192192

193193

194+
class MgrDBNotAllowed(MgrDBNotReady):
195+
"""A more specific subclass of MgrDBNotReady raised when mgr_pool option
196+
disabled.
197+
"""
198+
pass
199+
200+
194201
class OSDMap(ceph_module.BasePyOSDMap):
195202
def get_epoch(self) -> int:
196203
return self._get_epoch()
@@ -1357,7 +1364,7 @@ def db(self) -> sqlite3.Connection:
13571364
return self._db
13581365
db_allowed = self.get_ceph_option("mgr_pool")
13591366
if not db_allowed:
1360-
raise MgrDBNotReady()
1367+
raise MgrDBNotAllowed()
13611368
self._db = self.open_db()
13621369
if self._db is None:
13631370
raise MgrDBNotReady()

0 commit comments

Comments
 (0)