From 502c574c36f49947cb7a501cafd5530455451773 Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Fri, 17 Jul 2020 09:26:52 -0600 Subject: [PATCH] mgr/cephadm: clean-up service module type checking mypy cast to avoid: cephadm/module.py: note: In member "_config_fn" of class "CephadmOrchestrator": cephadm/module.py:1797: error: Incompatible return value type (got "Optional[function]", expected "Optional[Callable[[ServiceSpec], None]]") Signed-off-by: Michael Fritch --- src/pybind/mgr/cephadm/module.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 5605f5e23193b..8fec091c63d7c 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1794,12 +1794,13 @@ you may want to run: return "Removed {} from host '{}'".format(name, host) def _config_fn(self, service_type) -> Optional[Callable[[ServiceSpec], None]]: - return { + fn = { 'mds': self.mds_service.config, 'rgw': self.rgw_service.config, 'nfs': self.nfs_service.config, 'iscsi': self.iscsi_service.config, - }.get(service_type) # type: ignore + }.get(service_type) + return cast(Callable[[ServiceSpec], None], fn) def _apply_service(self, spec: ServiceSpec) -> bool: """ -- 2.47.3