Resolve merge conflict

pull/2630/merge
Michael DeHaan 12 years ago
parent 528cb2cb3d
commit be947e5266

@ -20,7 +20,6 @@
########################################################
import sys
import getpass
from ansible.runner import Runner
import ansible.constants as C
@ -101,13 +100,9 @@ class Cli(object):
sshpass = None
sudopass = None
options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS
if options.ask_pass:
sshpass = getpass.getpass(prompt="SSH password: ")
options.ask_sudo_pass= options.ask_sudo_pass or C.DEFAULT_ASK_SUDO_PASS
if options.ask_sudo_pass:
sudopass = getpass.getpass(prompt="sudo password: ")
options.sudo = True
if options.sudo_user:
( sshpass, sudopass ) = utils.ask_passwords(ask_pass=options.ask_pass, ask_sudo_pass=options.ask_sudo_pass)
if options.sudo_user or options.ask_sudo_pass:
options.sudo = True
options.sudo_user = options.sudo_user or C.DEFAULT_SUDO_USER
if options.tree:

@ -19,7 +19,6 @@
#######################################################
import sys
import getpass
import os
import ansible.playbook
@ -93,13 +92,9 @@ def main(args):
sudopass = None
if not options.listhosts and not options.syntax and not options.listtasks:
options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS
if options.ask_pass:
sshpass = getpass.getpass(prompt="SSH password: ")
options.ask_sudo_pass = options.ask_sudo_pass or C.DEFAULT_ASK_SUDO_PASS
if options.ask_sudo_pass:
sudopass = getpass.getpass(prompt="sudo password: ")
options.sudo = True
if options.sudo_user:
( sshpass, sudopass ) = utils.ask_passwords(ask_pass=options.ask_pass, ask_sudo_pass=options.ask_sudo_pass)
if options.sudo_user or options.ask_sudo_pass:
options.sudo = True
options.sudo_user = options.sudo_user or C.DEFAULT_SUDO_USER
extra_vars = utils.parse_kv(options.extra_vars)

@ -38,6 +38,7 @@ import random
import difflib
import warnings
import traceback
import getpass
VERBOSITY=0
@ -496,6 +497,22 @@ def base_parser(constants=C, usage="", output_opts=False, runas_opts=False,
return parser
def ask_passwords(ask_pass=False, ask_sudo_pass=False):
sshpass = None
sudopass = None
sudo_prompt = "sudo password: "
if ask_pass:
sshpass = getpass.getpass(prompt="SSH password: ")
sudo_prompt = "sudo password [defaults to SSH password]: "
if ask_sudo_pass:
sudopass = getpass.getpass(prompt=sudo_prompt)
if ask_pass and sudopass == '':
sudopass = sshpass
return (sshpass, sudopass)
def do_encrypt(result, encrypt, salt_size=None, salt=None):
if PASSLIB_AVAILABLE:
try:

Loading…
Cancel
Save