]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/mgr_module: annotate variable type
authorKefu Chai <kchai@redhat.com>
Tue, 19 Jan 2021 09:34:43 +0000 (17:34 +0800)
committerSebastian Wagner <sebastian.wagner@suse.com>
Fri, 29 Jan 2021 12:42:38 +0000 (13:42 +0100)
to silence following mypy error:

cephadm/module.py:1155: error: Incompatible types in assignment
(expression has type "None", variable has type "str")

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 00f5a80201923c85c50f8e8bb64e3e82458fd932)

src/pybind/mgr/cephadm/module.py

index 0d74aac71380cec5954815c4c4d6a0bcae125bef..063fc0d673104f7a0d542b6dd7a3836f967e8e9d 100644 (file)
@@ -1126,6 +1126,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
 
     def _get_container_image(self, daemon_name: str) -> Optional[str]:
         daemon_type = daemon_name.split('.', 1)[0]  # type: ignore
+        image: Optional[str] = None
         if daemon_type in CEPH_TYPES or \
                 daemon_type == 'nfs' or \
                 daemon_type == 'iscsi':
@@ -1135,7 +1136,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
                 'who': utils.name_to_config_section(daemon_name),
                 'key': 'container_image',
             })
-            image = image.strip()  # type: ignore
+            image = image.strip()
         elif daemon_type == 'prometheus':
             image = self.container_image_prometheus
         elif daemon_type == 'grafana':