From dec6345fe6bd612e1cf1590f768733c300771255 Mon Sep 17 00:00:00 2001 From: Rutger Spiertz Date: Fri, 17 Jan 2014 10:30:57 +0100 Subject: [PATCH] PlayBook: better error message When a PlayBook has missing arguments the error message now shows which ones are missing. --- lib/ansible/playbook/__init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index dc7991aaf7..a822d3f271 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -91,8 +91,17 @@ class PlayBook(object): self.SETUP_CACHE = SETUP_CACHE - if playbook is None or callbacks is None or runner_callbacks is None or stats is None: - raise Exception('missing required arguments') + arguments = [] + if playbook is None: + arguments.append('playbook') + if callbacks is None: + arguments.append('callbacks') + if runner_callbacks is None: + arguments.append('runner_callbacks') + if stats is None: + arguments.append('stats') + if arguments: + raise Exception('PlayBook missing required arguments: %s' % ', '.join(arguments)) if extra_vars is None: extra_vars = {}