started implementing 'list options'

pull/10612/head
Brian Coca 10 years ago
parent 2ade17e2f5
commit 20b4492704

@ -58,11 +58,14 @@ def main(args):
validate_conflicts(parser,options) validate_conflicts(parser,options)
# Note: slightly wrong, this is written so that implicit localhost
# Manage passwords # Manage passwords
sshpass = None sshpass = None
becomepass = None becomepass = None
vault_pass = None vault_pass = None
# don't deal with privilege escalation when we don't need to
if not options.listhosts and not options.listtasks and not options.listtags:
normalize_become_options(options) normalize_become_options(options)
(sshpass, becomepass, vault_pass) = ask_passwords(options) (sshpass, becomepass, vault_pass) = ask_passwords(options)
@ -109,7 +112,6 @@ def main(args):
inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=options.inventory) inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=options.inventory)
variable_manager.set_inventory(inventory) variable_manager.set_inventory(inventory)
# Note: slightly wrong, this is written so that implicit localhost
# (which is not returned in list_hosts()) is taken into account for # (which is not returned in list_hosts()) is taken into account for
# warning if inventory is empty. But it can't be taken into account for # warning if inventory is empty. But it can't be taken into account for
# checking if limit doesn't match any hosts. Instead we don't worry about # checking if limit doesn't match any hosts. Instead we don't worry about
@ -129,6 +131,17 @@ def main(args):
# create the playbook executor, which manages running the plays # create the playbook executor, which manages running the plays
# via a task queue manager # via a task queue manager
pbex = PlaybookExecutor(playbooks=args, inventory=inventory, variable_manager=variable_manager, loader=loader, options=options) pbex = PlaybookExecutor(playbooks=args, inventory=inventory, variable_manager=variable_manager, loader=loader, options=options)
if options.listhosts:
print('TODO: implement')
sys.exit(0)
elif options.listtasks:
print('TODO: implement')
sys.exit(0)
elif options.listtags:
print('TODO: implement')
sys.exit(0)
else:
return pbex.run() return pbex.run()
if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save