diff options
author | Tim Bielawa <tbielawa@redhat.com> | 2017-03-20 08:52:43 -0700 |
---|---|---|
committer | Tim Bielawa <tbielawa@redhat.com> | 2017-03-20 08:56:18 -0700 |
commit | 7fe79bdc2f322996132aab7db1ba04a6ce4c4ea5 (patch) | |
tree | 3c79220652f6743dd549c3a85cc74937245ab950 /callback_plugins | |
parent | 72780240fe1484b1abac60dbbec7a21bdf8ee58d (diff) | |
download | openshift-7fe79bdc2f322996132aab7db1ba04a6ce4c4ea5.tar.gz openshift-7fe79bdc2f322996132aab7db1ba04a6ce4c4ea5.tar.bz2 openshift-7fe79bdc2f322996132aab7db1ba04a6ce4c4ea5.tar.xz openshift-7fe79bdc2f322996132aab7db1ba04a6ce4c4ea5.zip |
Update the failure methods and add required variables/functions
Diffstat (limited to 'callback_plugins')
-rw-r--r-- | callback_plugins/openshift_quick_installer.py | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/callback_plugins/openshift_quick_installer.py b/callback_plugins/openshift_quick_installer.py index bf55dc857..c0fdbc650 100644 --- a/callback_plugins/openshift_quick_installer.py +++ b/callback_plugins/openshift_quick_installer.py @@ -54,6 +54,12 @@ class CallbackModule(CallbackBase): plays_count = 0 plays_total_ran = 0 + def __init__(self): + """Constructor, ensure standard self.*s are set""" + self._play = None + self._last_task_banner = None + super(CallbackModule, self).__init__() + def banner(self, msg, color=None): '''Prints a header-looking line with stars taking up to 80 columns of width (3 columns, minimum) @@ -68,6 +74,29 @@ class CallbackModule(CallbackBase): stars = "*" * star_len self._display.display("\n%s %s" % (msg, stars), color=color, log_only=True) + def _print_task_banner(self, task): + """Imported from the upstream 'default' callback""" + # args can be specified as no_log in several places: in the task or in + # the argument spec. We can check whether the task is no_log but the + # argument spec can't be because that is only run on the target + # machine and we haven't run it thereyet at this time. + # + # So we give people a config option to affect display of the args so + # that they can secure this if they feel that their stdout is insecure + # (shoulder surfing, logging stdout straight to a file, etc). + args = '' + if not task.no_log and C.DISPLAY_ARGS_TO_STDOUT: + args = ', '.join('%s=%s' % a for a in task.args.items()) + args = ' %s' % args + + self.banner(u"TASK [%s%s]" % (task.get_name().strip(), args)) + if self._display.verbosity >= 2: + path = task.get_path() + if path: + self._display.display(u"task path: %s" % path, color=C.COLOR_DEBUG, log_only=True) + + self._last_task_banner = task._uuid + def v2_playbook_on_start(self, playbook): """This is basically the start of it all""" self.plays_count = len(playbook.get_plays()) @@ -236,8 +265,6 @@ The only thing we change here is adding `log_only=True` to the """ self._display.display("skipping: no hosts matched", color=C.COLOR_SKIP, log_only=True) - - ###################################################################### # So we can bubble up errors to the top def v2_runner_on_failed(self, result, ignore_errors=False): @@ -291,7 +318,6 @@ The only thing we change here is adding `log_only=True` to the self._display.display(msg + " (item=%s) => %s" % (self._get_item(result._result), self._dump_results(result._result)), color=C.COLOR_ERROR) self._handle_warnings(result._result) - ###################################################################### def v2_playbook_on_stats(self, stats): """Print the final playbook run stats""" |