From 65d62090c2326c0b9382799fb8601d08b902315e Mon Sep 17 00:00:00 2001 From: Abhijit Menon-Sen Date: Mon, 27 Jul 2015 12:43:21 +0530 Subject: [PATCH] =?UTF-8?q?A=20better=20error=20message=20for=20=C2=ABansi?= =?UTF-8?q?ble=20playbook.yml=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a very conservative change: we add the hint only if we're definitely going to die already. --- lib/ansible/cli/adhoc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/cli/adhoc.py b/lib/ansible/cli/adhoc.py index 8fabed3256f..9d1ab681dab 100644 --- a/lib/ansible/cli/adhoc.py +++ b/lib/ansible/cli/adhoc.py @@ -116,7 +116,10 @@ class AdHocCLI(CLI): return 0 if self.options.module_name in C.MODULE_REQUIRE_ARGS and not self.options.module_args: - raise AnsibleOptionsError("No argument passed to %s module" % self.options.module_name) + err = "No argument passed to %s module" % self.options.module_name + if pattern.endswith(".yml"): + err = err + ' (did you mean to run ansible-playbook?)' + raise AnsibleOptionsError(err) #TODO: implement async support #if self.options.seconds: