From 0b86aa62e1d70e7ed9162df52512edee6e55aa12 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 14 Jan 2016 11:54:22 -0500 Subject: [PATCH] Hack to work around callback API change for v2_playbook_on_start --- lib/ansible/executor/task_queue_manager.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index ab46d6f78b..ed9de6603b 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -288,7 +288,20 @@ class TaskQueueManager: for method in methods: if method is not None: try: - method(*args, **kwargs) + # temporary hack, required due to a change in the callback API, so + # we don't break backwards compatibility with callbacks which were + # designed to use the original API + # FIXME: target for removal and revert to the original code here + # after a year (2017-01-14) + if method_name == 'v2_playbook_on_start': + import inspect + (f_args, f_varargs, f_keywords, f_defaults) = inspect.getargspec(method) + if 'playbook' in args: + method(*args, **kwargs) + else: + method() + else: + method(*args, **kwargs) except Exception as e: import traceback orig_tb = traceback.format_exc()