diff options
| author | Jenkins <jenkins@review.openstack.org> | 2014-09-07 15:12:18 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2014-09-07 15:12:18 +0000 |
| commit | 3317e0abf694c56cb3b24bdf2b2b10577ea47f6b (patch) | |
| tree | e9d6285ae671ae35f9a2c04100a69c1d21c3b837 /openstackclient/common/utils.py | |
| parent | dcf658cc4e6c6df4e1543178d78ef70338c95d11 (diff) | |
| parent | 0069adef5ccec501c36b8da1d2de2821a97afe07 (diff) | |
| download | python-openstackclient-3317e0abf694c56cb3b24bdf2b2b10577ea47f6b.tar.gz | |
Merge "Add action 'user password set' for identiy v3"
Diffstat (limited to 'openstackclient/common/utils.py')
| -rw-r--r-- | openstackclient/common/utils.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py index 227b0438..c013deee 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -220,12 +220,15 @@ def get_effective_log_level(): return min_log_lvl -def get_password(stdin): +def get_password(stdin, prompt=None, confirm=True): + message = prompt or "User Password:" if hasattr(stdin, 'isatty') and stdin.isatty(): try: while True: - first_pass = getpass.getpass("User password: ") - second_pass = getpass.getpass("Repeat user password: ") + first_pass = getpass.getpass(message) + if not confirm: + return first_pass + second_pass = getpass.getpass("Repeat " + message) if first_pass == second_pass: return first_pass print("The passwords entered were not the same") |
