]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ansible: Adapt code to use DriveGroupSpec and OrchestratorClientMixin
authorJuan Miguel Olmo Martínez <jolmomar@redhat.com>
Wed, 23 Jan 2019 08:23:33 +0000 (09:23 +0100)
committerJuan Miguel Olmo Martínez <jolmomar@redhat.com>
Wed, 23 Jan 2019 11:16:37 +0000 (12:16 +0100)
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 <osd add/rm vs osd create/remove>. 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 <jolmomar@redhat.com>
src/pybind/mgr/ansible/module.py
src/pybind/mgr/orchestrator_cli/module.py

index 8e4d85d89e60377b2a5dde240cd0504f1ce71ffd..87d016d135bf1f2666a01ac26357c3bff2e52dc0 100644 (file)
@@ -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
 
index 1ec99d032e17e9bd71caf44f86dc93cc95dad869..76711170754ab234de1188a1636f98ea372ae048 100644 (file)
@@ -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)