summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Bielawa <tbielawa@redhat.com>2016-09-23 10:56:56 -0700
committerTim Bielawa <tbielawa@redhat.com>2016-09-29 07:43:54 -0700
commitd53389707f4838249715ccc6e67bdc6c06c4cada (patch)
tree23809d2faf20f4d8f19ab2625cf582077ac84c72
parentba823255fcde17124b6dcc447bb00bc241346312 (diff)
downloadopenshift-d53389707f4838249715ccc6e67bdc6c06c4cada.tar.gz
openshift-d53389707f4838249715ccc6e67bdc6c06c4cada.tar.bz2
openshift-d53389707f4838249715ccc6e67bdc6c06c4cada.tar.xz
openshift-d53389707f4838249715ccc6e67bdc6c06c4cada.zip
Silence/dot-print more actions in the callback
-rw-r--r--callback_plugins/openshift_quick_installer.py51
1 files changed, 46 insertions, 5 deletions
diff --git a/callback_plugins/openshift_quick_installer.py b/callback_plugins/openshift_quick_installer.py
index abb22d2fa..9d490f02c 100644
--- a/callback_plugins/openshift_quick_installer.py
+++ b/callback_plugins/openshift_quick_installer.py
@@ -44,6 +44,7 @@ try:
except ImportError: # < ansible 2.1
BASECLASS = DEFAULT_MODULE.CallbackModule
+from ansible import constants as C
reload(sys)
sys.setdefaultencoding('utf-8')
@@ -61,6 +62,18 @@ class CallbackModule(DEFAULT_MODULE.CallbackModule):
plays_count = 0
plays_total_ran = 0
+ def banner(self, msg, color=None):
+ '''
+ Prints a header-looking line with stars taking up to 80 columns
+ of width (3 columns, minimum)
+ '''
+ msg = msg.strip()
+ star_len = (79 - len(msg))
+ if star_len < 0:
+ star_len = 3
+ stars = "*" * star_len
+ self._display.display("\n%s %s" % (msg, stars), color=color, log_only=True)
+
def v2_playbook_on_start(self, playbook):
"""This is basically the start of it all"""
self.plays_count = len(playbook.get_plays())
@@ -79,6 +92,14 @@ in the `play` object.
print("")
print("Play %s/%s (%s)" % (self.plays_total_ran, self.plays_count, play.get_name()))
+ name = play.get_name().strip()
+ if not name:
+ msg = "PLAY"
+ else:
+ msg = "PLAY [%s]" % name
+
+ self.banner(msg)
+
# pylint: disable=unused-argument,no-self-use
def v2_playbook_on_task_start(self, task, is_conditional):
"""This prints out the task header. For example:
@@ -90,6 +111,28 @@ character to indicate a task has been started.
"""
sys.stdout.write('.')
+ # pylint: disable=unused-argument,no-self-use
+ def v2_playbook_on_handler_task_start(self, task):
+ """Print out task header for handlers
+
+Rather than print out a header for every handler, we print a dot
+character to indicate a handler task has been started.
+"""
+ sys.stdout.write('.')
+
+ # pylint: disable=unused-argument,no-self-use
+ def v2_playbook_on_cleanup_task_start(self, task):
+ """Print out a task header for cleanup tasks
+
+Rather than print out a header for every handler, we print a dot
+character to indicate a handler task has been started.
+"""
+ sys.stdout.write('.')
+
+ def v2_playbook_on_include(self, included_file):
+ """Print out paths to statically included files"""
+ pass
+
def v2_runner_on_ok(self, result):
"""This prints out task results in a fancy format"""
pass
@@ -107,9 +150,7 @@ character to indicate a task has been started.
pass
def v2_playbook_on_notify(self, res, handler):
- """Printer for handlers
-
-Rather than print out a header for every handler, we print a dot
-character to indicate a handler task has been started.
+ """What happens when a task result is 'changed' and the task has a
+'notify' list attached.
"""
- sys.stdout.write('.')
+ pass