De-client-ify Group Update

Change-Id: Iff584891a07a619b57a1700351a7fe5f19ca8a57
This commit is contained in:
Samuel de Medeiros Queiroz 2017-07-19 06:26:03 -04:00
parent 57f5c896e0
commit b7f90dc661
3 changed files with 11 additions and 15 deletions

View File

@ -167,11 +167,6 @@ class GroupDelete(task_manager.Task):
return client.keystone_client.groups.delete(**self.args) return client.keystone_client.groups.delete(**self.args)
class GroupUpdate(task_manager.Task):
def main(self, client):
return client.keystone_client.groups.update(**self.args)
class RoleList(task_manager.Task): class RoleList(task_manager.Task):
def main(self, client): def main(self, client):
return client.keystone_client.roles.list() return client.keystone_client.roles.list()

View File

@ -1312,12 +1312,17 @@ class OperatorCloud(openstackcloud.OpenStackCloud):
"Group {0} not found for updating".format(name_or_id) "Group {0} not found for updating".format(name_or_id)
) )
with _utils.shade_exceptions( group_ref = {}
"Unable to update group {name}".format(name=name_or_id) if name:
): group_ref['name'] = name
group = self.manager.submit_task(_tasks.GroupUpdate( if description:
group=group['id'], name=name, description=description)) group_ref['description'] = description
error_msg = "Unable to update group {name}".format(name=name_or_id)
data = self._identity_client.patch(
'/groups/{id}'.format(id=group['id']),
json={'group': group_ref}, error_message=error_msg)
group = self._get_and_munchify('group', data)
self.list_groups.invalidate(self) self.list_groups.invalidate(self)
return _utils.normalize_groups([group])[0] return _utils.normalize_groups([group])[0]

View File

@ -91,11 +91,7 @@ class TestGroups(base.RequestsMockTestCase):
uri=self.get_mock_url(append=[group_data.group_id]), uri=self.get_mock_url(append=[group_data.group_id]),
status_code=200, status_code=200,
json=group_data.json_response, json=group_data.json_response,
validate=dict(json=group_data.json_request)), validate=dict(json=group_data.json_request))
dict(method='GET',
uri=self.get_mock_url(append=[group_data.group_id]),
status_code=200,
json=group_data.json_response)
]) ])
self.op_cloud.update_group(group_data.group_id, group_data.group_name, self.op_cloud.update_group(group_data.group_id, group_data.group_name,
group_data.description) group_data.description)