def do_var_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None, unsafe=None):
    result = None
    if sys.__stdin__.isatty():
        do_prompt = self.prompt
        if (prompt and (default is not None)):
            msg = ('%s [%s]: ' % (prompt, default))
        elif prompt:
            msg = ('%s: ' % prompt)
        else:
            msg = ('input for %s: ' % varname)
        if confirm:
            while True:
                result = do_prompt(msg, private)
                second = do_prompt(('confirm ' + msg), private)
                if (result == second):
                    break
                self.display('***** VALUES ENTERED DO NOT MATCH ****')
        else:
            result = do_prompt(msg, private)
    else:
        result = None
        self.warning('Not prompting as we are not in interactive mode')
    if ((not result) and (default is not None)):
        result = default
    if encrypt:
        from ansible.utils.encrypt import do_encrypt
        result = do_encrypt(result, encrypt, salt_size, salt)
    result = to_text(result, errors='surrogate_or_strict')
    if unsafe:
        result = wrap_var(result)
    return result
def do_var_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None, unsafe=None):
    result = None
    if sys.__stdin__.isatty():
        do_prompt = self.prompt
        if (prompt and (default is not None)):
            msg = ('%s [%s]: ' % (prompt, default))
        elif prompt:
            msg = ('%s: ' % prompt)
        else:
            msg = ('input for %s: ' % varname)
        if confirm:
            while True:
                result = do_prompt(msg, private)
                second = do_prompt(('confirm ' + msg), private)
                if (result == second):
                    break
                self.display('***** VALUES ENTERED DO NOT MATCH ****')
        else:
            result = do_prompt(msg, private)
    else:
        result = None
        self.warning('Not prompting as we are not in interactive mode')
    if ((not result) and (default is not None)):
        result = default
    if encrypt:
        from ansible.utils.encrypt import do_encrypt
        result = do_encrypt(result, encrypt, salt_size, salt)
    result = to_text(result, errors='surrogate_or_strict')
    if unsafe:
        result = wrap_var(result)
    return result