From 5e2149b132e54e1ee17b80b6342e63161e1fc760 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 19 Jan 2021 17:34:43 +0800 Subject: [PATCH] pybind/mgr/mgr_module: annotate variable type 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 (cherry picked from commit 00f5a80201923c85c50f8e8bb64e3e82458fd932) --- src/pybind/mgr/cephadm/module.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 0d74aac71380c..063fc0d673104 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -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': -- 2.39.5