diff options
author | Christian Breunig <christian@breunig.cc> | 2023-12-13 07:54:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-13 07:54:43 +0100 |
commit | fc79bc088a69318ec960396b8757849e86c11f20 (patch) | |
tree | 1d377bb4c3f9e2b8cb66c43422e727053b09e191 /python | |
parent | dd64840da821e43667d77453b80010c36acc5d4e (diff) | |
parent | cf83979636c686a459d6dc75dcd98e342c70b1b3 (diff) | |
download | vyos-1x-fc79bc088a69318ec960396b8757849e86c11f20.tar.gz vyos-1x-fc79bc088a69318ec960396b8757849e86c11f20.zip |
Merge pull request #2622 from jestabro/obscure-passwd-on-install
image-tools: T5819: do not echo password on image install
Diffstat (limited to 'python')
-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: |