mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Move the check for playbook files above the password prompting.
Fixes #9904
This commit is contained in:
parent
d7207b3910
commit
6d9771bbf8
1 changed files with 8 additions and 8 deletions
|
@ -95,6 +95,14 @@ class PlaybookCLI(CLI):
|
||||||
vault_pass = None
|
vault_pass = None
|
||||||
passwords = {}
|
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
|
# 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:
|
if not self.options.listhosts and not self.options.listtasks and not self.options.listtags and not self.options.syntax:
|
||||||
self.normalize_become_options()
|
self.normalize_become_options()
|
||||||
|
@ -111,14 +119,6 @@ class PlaybookCLI(CLI):
|
||||||
vault_pass = self.ask_vault_passwords()[0]
|
vault_pass = self.ask_vault_passwords()[0]
|
||||||
loader.set_vault_password(vault_pass)
|
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
|
# create the variable manager, which will be shared throughout
|
||||||
# the code, ensuring a consistent view of global variables
|
# the code, ensuring a consistent view of global variables
|
||||||
variable_manager = VariableManager()
|
variable_manager = VariableManager()
|
||||||
|
|
Loading…
Reference in a new issue