From: Michael Fritch Date: Fri, 17 Jul 2020 15:26:52 +0000 (-0600) Subject: mgr/cephadm: clean-up service module type checking X-Git-Tag: v15.2.5~105^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9293a697a9f006ebb0c5cba94e1ad1d12c3e4ac9;p=ceph.git 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 (cherry picked from commit 502c574c36f49947cb7a501cafd5530455451773) --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 9198f770582..dd9582805c6 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1842,12 +1842,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: """