From 6d9771bbf8217ad89090ccd7b2471664bf53b8b3 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 31 Oct 2016 11:54:33 -0400 Subject: [PATCH] Move the check for playbook files above the password prompting. Fixes #9904 --- lib/ansible/cli/playbook.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/ansible/cli/playbook.py b/lib/ansible/cli/playbook.py index 74f0f83a7c0..645b74b3378 100644 --- a/lib/ansible/cli/playbook.py +++ b/lib/ansible/cli/playbook.py @@ -95,6 +95,14 @@ class PlaybookCLI(CLI): vault_pass = None passwords = {} + # initial error check, to make sure all specified playbooks are accessible + # before we start running anything through the playbook executor + for playbook in self.args: + if not os.path.exists(playbook): + raise AnsibleError("the playbook: %s could not be found" % playbook) + if not (os.path.isfile(playbook) or stat.S_ISFIFO(os.stat(playbook).st_mode)): + raise AnsibleError("the playbook: %s does not appear to be a file" % playbook) + # don't deal with privilege escalation or passwords when we don't need to if not self.options.listhosts and not self.options.listtasks and not self.options.listtags and not self.options.syntax: self.normalize_become_options() @@ -111,14 +119,6 @@ class PlaybookCLI(CLI): vault_pass = self.ask_vault_passwords()[0] loader.set_vault_password(vault_pass) - # initial error check, to make sure all specified playbooks are accessible - # before we start running anything through the playbook executor - for playbook in self.args: - if not os.path.exists(playbook): - raise AnsibleError("the playbook: %s could not be found" % playbook) - if not (os.path.isfile(playbook) or stat.S_ISFIFO(os.stat(playbook).st_mode)): - raise AnsibleError("the playbook: %s does not appear to be a file" % playbook) - # create the variable manager, which will be shared throughout # the code, ensuring a consistent view of global variables variable_manager = VariableManager()