From: Nizamudeen A Date: Wed, 18 Oct 2023 06:36:47 +0000 (+0530) Subject: mgr/dashboard: support rgw roles removal X-Git-Tag: v18.2.4~149^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5446a20b2699e6d0b989d3507a8f596a0d1b1a43;p=ceph.git mgr/dashboard: support rgw roles removal Fixes: https://tracker.ceph.com/issues/63230 Signed-off-by: Nizamudeen A (cherry picked from commit 2e06ab0b8c730f063e1376b2f330c3b78089af67) --- diff --git a/src/pybind/mgr/dashboard/controllers/rgw.py b/src/pybind/mgr/dashboard/controllers/rgw.py index fc4c2f48eb1ca..4dd3872aea5b1 100644 --- a/src/pybind/mgr/dashboard/controllers/rgw.py +++ b/src/pybind/mgr/dashboard/controllers/rgw.py @@ -718,6 +718,16 @@ class RGWRoleEndpoints: return f'Role {role_name} created successfully' + @staticmethod + def role_delete(_, role_name: str): + assert role_name + rgw_client = RgwClient.admin_instance() + rgw_client.delete_role(role_name) + return f'Role {role_name} deleted successfully' + + + + # pylint: disable=C0301 assume_role_policy_help = ( 'Paste a json assume role policy document, to find more information on how to get this document, None: + rgw_delete_role_command = ['role', 'delete', '--role-name', role_name] + code, _, _err = mgr.send_rgwadmin_command(rgw_delete_role_command, + stdout_as_json=False) + if code != 0: + raise DashboardException(msg=f'Error deleting role with code {code}: {_err}', + component='rgw') @RestClient.api_get('/{bucket_name}?policy') def get_bucket_policy(self, bucket_name: str, request=None):