From 1a75c46df7380e4afd45e6f85f35fef3f3295067 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 18 Mar 2020 11:25:11 +0100 Subject: [PATCH] fixup mgr/cephadm: Fix ceph orch apply -i Signed-off-by: Sebastian Wagner --- src/pybind/mgr/orchestrator/_interface.py | 25 ++++++++++++++++++++--- src/pybind/mgr/orchestrator/module.py | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index c03753c0dbb..545054d3ea0 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -846,9 +846,28 @@ class Orchestrator(object): def apply(self, specs: List[ServiceSpec]) -> Completion: """ - Saves Service Specs from a yaml|json file - """ - raise NotImplementedError() + Applies any spec + """ + fns = { + 'alertmanager': self.apply_alertmanager, + 'crash': self.apply_crash, + 'grafana': self.apply_grafana, + 'mds': self.apply_mds, + 'mgr': self.apply_mgr, + 'mon': self.apply_mon, + 'nfs': self.apply_nfs, + 'node-exporter': self.apply_node_exporter, + 'osd': self.apply_drivegroups, + 'prometheus': self.apply_prometheus, + 'rbd-mirror': self.apply_rbd_mirror, + 'rgw': self.apply_rgw, + } + spec, [specs] = specs + + completion = fns[spec.service_name](spec) + for s in specs: + completion.then(fns[spec.service_name](spec)) + return completion def remove_daemons(self, names): # type: (List[str]) -> Completion diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index d7bb43bdd80..a0de33fa0c7 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -703,7 +703,7 @@ Usage: completion = self.list_specs(service_name=service_name) self._orchestrator_wait([completion]) raise_if_exception(completion) - specs = completion.result() + specs = completion.result return HandleCommandResult(stdout=yaml.safe_dump_all(specs)) @_cli_write_command( -- 2.39.5