]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/orch: fix mypy errors
authorMichael Fritch <mfritch@suse.com>
Mon, 4 May 2020 20:54:54 +0000 (14:54 -0600)
committerMichael Fritch <mfritch@suse.com>
Tue, 5 May 2020 18:54:46 +0000 (12:54 -0600)
orchestrator/module.py: note: In member "_daemon_add_misc" of class "OrchestratorCli":
orchestrator/module.py:655: error: Incompatible types in assignment (expression has type "PlacementSpec", variable has type "Optional[str]")
orchestrator/module.py:656: error: Argument 1 to "ServiceSpec" has incompatible type "Optional[str]"; expected "str"
orchestrator/module.py:656: error: Argument "placement" to "ServiceSpec" has incompatible type "Optional[str]"; expected "Optional[PlacementSpec]"

orchestrator/module.py: note: In member "_apply_misc" of class "OrchestratorCli":
orchestrator/module.py:881: error: Incompatible types in assignment (expression has type "PlacementSpec", variable has type "Optional[str]")
orchestrator/module.py:882: error: Argument 1 to "ServiceSpec" has incompatible type "Optional[str]"; expected "str"
orchestrator/module.py:882: error: Argument "placement" to "ServiceSpec" has incompatible type "Optional[str]"; expected "Optional[PlacementSpec

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/pybind/mgr/orchestrator/module.py

index 9f33874d9b08f269c761bc277cd30bf2c7075cd2..958005221483b4425451a314a09b744a2f443b26 100644 (file)
@@ -652,8 +652,9 @@ Usage:
                 raise OrchestratorValidationError(usage)
             spec = ServiceSpec.from_json(yaml.safe_load(inbuf))
         else:
-            placement = PlacementSpec.from_string(placement)  # type: ignore
-            spec = ServiceSpec(daemon_type, placement=placement)  # type: ignore
+            spec = PlacementSpec.from_string(placement)
+            assert daemon_type
+            spec = ServiceSpec(daemon_type, placement=spec)
 
         daemon_type = spec.service_type
 
@@ -875,8 +876,9 @@ Usage:
             content: Iterator = yaml.load_all(inbuf)
             specs = [ServiceSpec.from_json(s) for s in content]
         else:
-            placement = PlacementSpec.from_string(placement)  # type: ignore
-            specs = [ServiceSpec(service_type, placement=placement, unmanaged=unmanaged)]  # type: ignore
+            spec = PlacementSpec.from_string(placement)
+            assert service_type
+            specs = [ServiceSpec(service_type, placement=spec, unmanaged=unmanaged)]
 
         completion = self.apply(specs)
         self._orchestrator_wait([completion])