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/identity | |
| 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/identity')
| -rw-r--r-- | openstackclient/identity/v3/user.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/openstackclient/identity/v3/user.py b/openstackclient/identity/v3/user.py index 38c34973..6ba54368 100644 --- a/openstackclient/identity/v3/user.py +++ b/openstackclient/identity/v3/user.py @@ -323,6 +323,35 @@ class SetUser(command.Command): return +class SetPasswordUser(command.Command): + """Change current user password""" + + log = logging.getLogger(__name__ + '.SetPasswordUser') + + def get_parser(self, prog_name): + parser = super(SetPasswordUser, self).get_parser(prog_name) + parser.add_argument( + '--password', + metavar='<new-password>', + help='New user password' + ) + return parser + + def take_action(self, parsed_args): + self.log.debug('take_action(%s)', parsed_args) + identity_client = self.app.client_manager.identity + + current_password = utils.get_password( + self.app.stdin, prompt="Current Password:", confirm=False) + + password = parsed_args.password + if password is None: + password = utils.get_password( + self.app.stdin, prompt="New Password:") + + identity_client.users.update_password(current_password, password) + + class ShowUser(show.ShowOne): """Show user details""" |
