]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: clean-up service module type checking 36147/head
authorMichael Fritch <mfritch@suse.com>
Fri, 17 Jul 2020 15:26:52 +0000 (09:26 -0600)
committerMichael Fritch <mfritch@suse.com>
Fri, 17 Jul 2020 15:26:52 +0000 (09:26 -0600)
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 <mfritch@suse.com>
src/pybind/mgr/cephadm/module.py

index 5605f5e23193b672a3918bba9567892c38fca850..8fec091c63d7cfc3c93128e94ce65462fce26a84 100644 (file)
@@ -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:
         """