De-client-ify User Password Update
Change-Id: Idfafc845e44c5a2eb9c6f334a1a4d7eb83c7ce2c
This commit is contained in:
parent
e76896046d
commit
76caad4d42
@ -17,11 +17,6 @@
|
||||
from shade import task_manager
|
||||
|
||||
|
||||
class UserPasswordUpdate(task_manager.Task):
|
||||
def main(self, client):
|
||||
return client.keystone_client.users.update_password(**self.args)
|
||||
|
||||
|
||||
class MachineCreate(task_manager.Task):
|
||||
def main(self, client):
|
||||
return client.ironic_client.node.create(**self.args)
|
||||
|
@ -44,7 +44,6 @@ from shade import _legacy_clients
|
||||
from shade import _normalize
|
||||
from shade import meta
|
||||
from shade import task_manager
|
||||
from shade import _tasks
|
||||
from shade import _utils
|
||||
|
||||
OBJECT_MD5_KEY = 'x-object-meta-x-shade-md5'
|
||||
@ -1008,10 +1007,12 @@ class OpenStackCloud(
|
||||
with _utils.shade_exceptions(
|
||||
"Error updating password for {user}".format(
|
||||
user=name_or_id)):
|
||||
# normalized dict won't work
|
||||
user = self.manager.submit_task(_tasks.UserPasswordUpdate(
|
||||
user=self.get_user_by_id(user['id'], normalize=False),
|
||||
password=password))
|
||||
error_msg = "Error updating password for user {}".format(
|
||||
name_or_id)
|
||||
data = self._identity_client.put(
|
||||
'/users/{u}/OS-KSADM/password'.format(u=user['id']),
|
||||
json={'user': {'password': password}},
|
||||
error_message=error_msg)
|
||||
|
||||
# Identity v2.0 implements PUT. v3 PATCH. Both work as PATCH.
|
||||
data = self._identity_client.put(
|
||||
|
@ -98,16 +98,11 @@ class TestUsers(base.RequestsMockTestCase):
|
||||
|
||||
self.register_uris([
|
||||
# GET list to find user id
|
||||
# GET user info with user_id from list
|
||||
# PUT user with password update
|
||||
# GET user info with id after update
|
||||
# PUT empty update (password change is different than update)
|
||||
# but is always chained together [keystoneclient oddity]
|
||||
# GET user info after user update
|
||||
dict(method='GET', uri=mock_users_uri, status_code=200,
|
||||
json=self._get_user_list(user_data)),
|
||||
dict(method='GET', uri=mock_user_resource_uri, status_code=200,
|
||||
json=user_data.json_response),
|
||||
dict(method='PUT',
|
||||
uri=self._get_keystone_mock_url(
|
||||
resource='users', v3=False,
|
||||
@ -115,8 +110,6 @@ class TestUsers(base.RequestsMockTestCase):
|
||||
status_code=200, json=user_data.json_response,
|
||||
validate=dict(
|
||||
json={'user': {'password': user_data.password}})),
|
||||
dict(method='GET', uri=mock_user_resource_uri, status_code=200,
|
||||
json=user_data.json_response),
|
||||
dict(method='PUT', uri=mock_user_resource_uri, status_code=200,
|
||||
json=user_data.json_response,
|
||||
validate=dict(json={'user': {}}))])
|
||||
|
Loading…
Reference in New Issue
Block a user