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