From: Sebastian Wagner Date: Fri, 29 Jan 2021 10:10:38 +0000 (+0100) Subject: mgr/cephadm: Add strings to assert statements X-Git-Tag: v16.2.0~207^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7018e054a616f93b3dbb9f40bd14711436bea181;p=ceph.git mgr/cephadm: Add strings to assert statements This helps with: https://tracker.ceph.com/issues/48981 Looks like there is an assert somewhere: ``` Error EINVAL: Traceback (most recent call last): File "/usr/share/ceph/mgr/mgr_module.py", line 1269, in _handle_command return self.handle_command(inbuf, cmd) ...snip... File "/usr/share/ceph/mgr/orchestrator/module.py", line 550, in _list_services raise_if_exception(completion) File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 653, in raise_if_exception raise e AssertionError ``` Signed-off-by: Sebastian Wagner (cherry picked from commit 06f4d84166f9c0761ace002fa2091dcd1d78f2d6) --- diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index 1b51547c6c99..ee82f78e2041 100644 --- a/src/pybind/mgr/cephadm/inventory.py +++ b/src/pybind/mgr/cephadm/inventory.py @@ -467,7 +467,7 @@ class HostCache(): """Provide a list of the types of daemons on the host""" result = set() for _d, dm in self.daemons[hostname].items(): - assert dm.daemon_type is not None + assert dm.daemon_type is not None, f'no daemon type for {dm!r}' result.add(dm.daemon_type) return list(result) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index ab35f4af688f..9e0232f433f6 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1469,8 +1469,8 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, osd_count = 0 for h, dm in self.cache.get_daemons_with_volatile_status(): for name, dd in dm.items(): - assert dd.hostname is not None - assert dd.daemon_type is not None + assert dd.hostname is not None, f'no hostname for {dd!r}' + assert dd.daemon_type is not None, f'no daemon_type for {dd!r}' if service_type and service_type != dd.daemon_type: continue