]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr/cephadm/serve: add assert to appease mypy
authorKefu Chai <kchai@redhat.com>
Tue, 19 Jan 2021 17:26:06 +0000 (01:26 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 26 Jan 2021 10:02:24 +0000 (18:02 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/cephadm/serve.py

index 8a4e4601e74454323f3df63c3581bde5f34c31ff..419398edd5d9d490cc49f08c845b5dbca070ff20 100644 (file)
@@ -401,13 +401,17 @@ class CephadmServe:
             daemon_detail = []  # type: List[str]
             for item in ls:
                 host = item.get('hostname')
+                assert isinstance(host, str)
                 daemons = item.get('services')  # misnomer!
+                assert isinstance(daemons, list)
                 missing_names = []
                 for s in daemons:
-                    name = '%s.%s' % (s.get('type'), s.get('id'))
+                    daemon_id = s.get('id')
+                    assert daemon_id
+                    name = '%s.%s' % (s.get('type'), daemon_id)
                     if s.get('type') == 'rbd-mirror':
                         metadata = self.mgr.get_metadata(
-                            "rbd-mirror", s.get('id'))
+                            "rbd-mirror", daemon_id)
                         try:
                             name = '%s.%s' % (s.get('type'), metadata['id'])
                         except (KeyError, TypeError):