diff options
| author | Terry Howe <terrylhowe@gmail.com> | 2014-02-19 19:30:56 -0700 |
|---|---|---|
| committer | Terry Howe <terrylhowe@gmail.com> | 2014-02-21 14:42:22 -0700 |
| commit | 033f27fe4dc4455c2f07978a273fd65faa653b67 (patch) | |
| tree | 56126c4cd1a4d0aebbab6d0b7cfa6507ca3d195a /openstackclient/identity/v3 | |
| parent | 2f5e8232aa07a9031231ad7b4678b7c52c1effc4 (diff) | |
| download | python-openstackclient-033f27fe4dc4455c2f07978a273fd65faa653b67.tar.gz | |
Add ability to prompt for passwords for user create and set
* Add get_password method to the utilities
* Add --password-prompt option
* Call the get_password method if a prompt is requested
* Various tests
Change-Id: I1786ad531e2a2fbcc21b8bc86aac0ccd7985995a
Closes-Bug: 1100116
Diffstat (limited to 'openstackclient/identity/v3')
| -rw-r--r-- | openstackclient/identity/v3/user.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/openstackclient/identity/v3/user.py b/openstackclient/identity/v3/user.py index 54ffe561..7e710ac0 100644 --- a/openstackclient/identity/v3/user.py +++ b/openstackclient/identity/v3/user.py @@ -44,6 +44,12 @@ class CreateUser(show.ShowOne): help='New user password', ) parser.add_argument( + '--password-prompt', + dest="password_prompt", + action="store_true", + help='Prompt interactively for password', + ) + parser.add_argument( '--email', metavar='<user-email>', help='New user email address', @@ -97,6 +103,8 @@ class CreateUser(show.ShowOne): enabled = True if parsed_args.disable: enabled = False + if parsed_args.password_prompt: + parsed_args.password = utils.get_password(self.app.stdin) user = identity_client.users.create( parsed_args.name, @@ -274,6 +282,12 @@ class SetUser(command.Command): help='New user password', ) parser.add_argument( + '--password-prompt', + dest="password_prompt", + action="store_true", + help='Prompt interactively for password', + ) + parser.add_argument( '--email', metavar='<user-email>', help='New user email address', @@ -310,6 +324,9 @@ class SetUser(command.Command): self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity + if parsed_args.password_prompt: + parsed_args.password = utils.get_password(self.app.stdin) + if (not parsed_args.name and not parsed_args.name and not parsed_args.password |
