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: v16.1.0~1667^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F36147%2Fhead;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 --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 5605f5e23193..8fec091c63d7 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: """