summaryrefslogtreecommitdiffstats
path: root/deploy/status_callback.py
diff options
context:
space:
mode:
authorhuangxiangyu <huangxiangyu5@huawei.com>2017-05-18 15:38:25 +0800
committerhuangxiangyu <huangxiangyu5@huawei.com>2017-06-09 10:07:11 +0800
commitd635bd1f5762acd78545b650b2f55c112643b486 (patch)
treec539533023277ed1fe95d4a65e483a458801f869 /deploy/status_callback.py
parentfe888225b54b228ab319573697daab9a0523f2bb (diff)
support Containerized compass-core
JIRA: COMPASS-534 1. rm compass vm and add ansible to bring up 5 compass containers 2. use tar package instead of compass.iso which contains compass docker images, OS ISO, PPA, pip packages. 3. modify client.py to communicate with containerized compass-core 4. modify cobbler files and ansible callback files to adapt with containerized compass-core 5. upgrade openstack version to ocata 6. use the openstack-ansible to deploy openstack 7. virtual deploy external use nat Change-Id: Ifa2a3f5b8c7c32224ac4276fd3d4cc2b0d270a26 Signed-off-by: huangxiangyu <huangxiangyu5@huawei.com>
Diffstat (limited to 'deploy/status_callback.py')
-rw-r--r--deploy/status_callback.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/deploy/status_callback.py b/deploy/status_callback.py
index 9136804f..47df1d30 100644
--- a/deploy/status_callback.py
+++ b/deploy/status_callback.py
@@ -20,7 +20,7 @@ def task_error(display, host, data):
# if isinstance(data, dict):
# invocation = data.pop('invocation', {})
- notify_host(display, "localhost", host, "failed")
+ notify_host(display, "compass-deck", host, "failed")
class CallbackModule(CallbackBase):
@@ -38,8 +38,9 @@ class CallbackModule(CallbackBase):
def v2_on_any(self, *args, **kwargs):
pass
- def v2_runner_on_failed(self, host, res, ignore_errors=False):
- task_error(self._display, host, res)
+ def v2_runner_on_failed(self, res, ignore_errors=False):
+ # task_error(self._display, host, res)
+ pass
def v2_runner_on_ok(self, host, res):
pass
@@ -60,7 +61,8 @@ class CallbackModule(CallbackBase):
pass
def v2_runner_on_async_failed(self, host, res, jid):
- task_error(self._display, host, res)
+ # task_error(self._display, host, res)
+ pass
def v2_playbook_on_start(self):
pass
@@ -97,29 +99,27 @@ class CallbackModule(CallbackBase):
def v2_playbook_on_stats(self, stats):
self._display.display("playbook_on_stats enter")
- all_vars = self.play.get_variable_manager().get_vars(self.loader)
- host_vars = all_vars["hostvars"]
hosts = sorted(stats.processed.keys())
- cluster_name = host_vars[hosts[0]]['cluster_name']
failures = False
unreachable = False
for host in hosts:
summary = stats.summarize(host)
+ # self._display.display("host: %s \nsummary: %s\n" % (host, summary)) # noqa
if summary['failures'] > 0:
failures = True
if summary['unreachable'] > 0:
unreachable = True
+ clusterhosts = set(hosts) - set(['localhost'])
if failures or unreachable:
- for host in hosts:
- notify_host(self._display, "localhost", host, "error")
+ for host in clusterhosts:
+ notify_host(self._display, "compass-deck", host, "error")
return
- for host in hosts:
- clusterhost_name = host + "." + cluster_name
- notify_host(self._display, "localhost", clusterhost_name, "succ")
+ for host in clusterhosts:
+ notify_host(self._display, "compass-deck", host, "succ")
def raise_for_status(resp):
@@ -144,13 +144,13 @@ def auth(conn):
def notify_host(display, compass_host, host, status):
+ display.display("hostname: %s" % host)
+ host = host.strip("host")
+ url = "/api/clusterhosts/%s/state" % host
if status == "succ":
- body = {"ready": True}
- url = "/api/clusterhosts/%s/state_internal" % host
+ body = {"state": "SUCCESSFUL"}
elif status == "error":
body = {"state": "ERROR"}
- host = host.strip("host")
- url = "/api/clusterhosts/%s/state" % host
else:
display.error("notify_host: host %s with status %s is not supported"
% (host, status))