diff options
author | Justin chi <chigang@huawei.com> | 2017-06-09 07:26:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-06-09 07:26:19 +0000 |
commit | dcce2491af9015d6d903d784ae1c145f329ece43 (patch) | |
tree | 617c90be07cccce7407598d66398536999344116 /deploy/status_callback.py | |
parent | 8ed47ae6ab2e57a37cd90707adcd0b2ea53362a1 (diff) | |
parent | d635bd1f5762acd78545b650b2f55c112643b486 (diff) |
Merge "support Containerized compass-core"
Diffstat (limited to 'deploy/status_callback.py')
-rw-r--r-- | deploy/status_callback.py | 32 |
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)) |