Merge "De-client-ify User Password Update"

This commit is contained in:
Jenkins 2017-09-06 14:45:26 +00:00 committed by Gerrit Code Review
commit e239dcd66b
3 changed files with 6 additions and 17 deletions

View File

@ -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)

View File

@ -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'
@ -1012,10 +1011,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(

View File

@ -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': {}}))])