diff options
author | John Estabrook <jestabro@vyos.io> | 2023-12-12 12:42:40 -0600 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2023-12-16 20:37:11 -0600 |
commit | 300f902f823be2d031f1ed3b7574332ed51b88b5 (patch) | |
tree | b0bfcbfaff7c7bc33b46173e7b2d97a23d199cf5 /python/vyos/utils | |
parent | 58dcd542f5b06c6d0e335b0476b76cde6920be80 (diff) | |
download | vyos-1x-300f902f823be2d031f1ed3b7574332ed51b88b5.tar.gz vyos-1x-300f902f823be2d031f1ed3b7574332ed51b88b5.zip |
image-tools: T5819: do not echo password on image install
(cherry picked from commit cf83979636c686a459d6dc75dcd98e342c70b1b3)
Diffstat (limited to 'python/vyos/utils')
-rw-r--r-- | python/vyos/utils/io.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/python/vyos/utils/io.py b/python/vyos/utils/io.py index 74099b502..0afaf695c 100644 --- a/python/vyos/utils/io.py +++ b/python/vyos/utils/io.py @@ -26,13 +26,18 @@ def print_error(str='', end='\n'): sys.stderr.write(end) sys.stderr.flush() -def ask_input(question, default='', numeric_only=False, valid_responses=[]): +def ask_input(question, default='', numeric_only=False, valid_responses=[], + no_echo=False): + from getpass import getpass question_out = question if default: question_out += f' (Default: {default})' response = '' while True: - response = input(question_out + ' ').strip() + if not no_echo: + response = input(question_out + ' ').strip() + else: + response = getpass(question_out + ' ').strip() if not response and default: return default if numeric_only: |