From: Juan Miguel Olmo Martínez Date: Wed, 23 Jan 2019 08:23:33 +0000 (+0100) Subject: mgr/ansible: Adapt code to use DriveGroupSpec and OrchestratorClientMixin X-Git-Tag: v14.1.0~294^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=807e3325f7255cfe04bf0de8bd755b64ed5048be;p=ceph-ci.git mgr/ansible: Adapt code to use DriveGroupSpec and OrchestratorClientMixin Apart of this two major changes, and due the long time this PR has been opened, other minor modifications coming from the orchestrators world has been merged. Not solved yet the discussion around . Once we have a a common code base we can decide what names we should use and what implementation is the more adequate. Signed-off-by: Juan Miguel Olmo Martínez --- diff --git a/src/pybind/mgr/ansible/module.py b/src/pybind/mgr/ansible/module.py index 8e4d85d89e6..87d016d135b 100644 --- a/src/pybind/mgr/ansible/module.py +++ b/src/pybind/mgr/ansible/module.py @@ -104,16 +104,19 @@ class AnsibleReadOperation(orchestrator.ReadCompletion): processed_result = [] - if self._is_complete: - raw_result = self.pb_execution.get_result(self.event_filter) - - if self.process_output: - processed_result = self.process_output( - raw_result, - self.ar_client, - self.pb_execution.play_uuid) - else: - processed_result = raw_result + raw_result = self.pb_execution.get_result(self.event_filter) + + if self.process_output: + processed_result = self.process_output( + raw_result, + self.ar_client, + self.pb_execution.play_uuid) + else: + processed_result = raw_result + + #Clean objects to avoid problems between interpreters + self.pb_execution = None + self.ar_client = None self._result = processed_result diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 1ec99d032e1..76711170754 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -232,10 +232,10 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule): self.wait([host_completion]) all_hosts = [h.name for h in host_completion.result] - completion = self.create_osds(spec, all_hosts) - self._orchestrator_wait([completion]) - #return result - return HandleCommandResult(stdout=completion.result) + try: + json_dg = json.loads(params) + except ValueError as msg: + return HandleCommandResult(-errno.EINVAL, stderr=msg) def _add_stateless_svc(self, svc_type, spec): completion = self.add_stateless_service(svc_type, spec)