Merge "De-client-ify Role Delete"

This commit is contained in:
Jenkins 2017-07-21 01:50:23 +00:00 committed by Gerrit Code Review
commit 6c1aafc9a0
2 changed files with 5 additions and 8 deletions

View File

@ -162,11 +162,6 @@ class EndpointDelete(task_manager.Task):
return client.keystone_client.endpoints.delete(**self.args)
class RoleDelete(task_manager.Task):
def main(self, client):
return client.keystone_client.roles.delete(**self.args)
class RoleAddUser(task_manager.Task):
def main(self, client):
return client.keystone_client.roles.add_user_role(**self.args)

View File

@ -1653,9 +1653,11 @@ class OperatorCloud(openstackcloud.OpenStackCloud):
"Role %s not found for deleting", name_or_id)
return False
with _utils.shade_exceptions("Unable to delete role {name}".format(
name=name_or_id)):
self.manager.submit_task(_tasks.RoleDelete(role=role['id']))
v2 = self.cloud_config.get_api_version('identity').startswith('2')
url = '{preffix}/{id}'.format(
preffix='/OS-KSADM/roles' if v2 else '/roles', id=role['id'])
error_msg = "Unable to delete role {name}".format(name=name_or_id)
self._identity_client.delete(url, error_message=error_msg)
return True