diff options
| author | Mouad Benchchaoui <m.benchchaoui@x-ion.de> | 2014-07-10 13:23:35 +0200 |
|---|---|---|
| committer | Steve Martinelli <stevemar@ca.ibm.com> | 2014-09-07 02:37:54 -0400 |
| commit | 0069adef5ccec501c36b8da1d2de2821a97afe07 (patch) | |
| tree | 6d4cb9db017547989aa225281e28221d8c6f3341 /openstackclient/common/utils.py | |
| parent | 8e12949958143e7db9783ef6246e6b09def0ad8e (diff) | |
| download | python-openstackclient-0069adef5ccec501c36b8da1d2de2821a97afe07.tar.gz | |
Add action 'user password set' for identiy v3
This new action will allow a user to change their own password by
either providing the new password as an argument (--password) or by
being prompted to enter the new password.
In both cases user will be prompted to enter their current password
as required by the v3 API.
Closes-Bug: #1337245
Change-Id: I5e1e0fd2b46a4502318da57f7cce2b236fb2d93d
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 0258f931..54a06b04 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -233,12 +233,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") |
