Issue #1078
closedUnable to remove a remove a user from "super-users" role
Description
try the following sequence of commands on a clean pulp install
$ pulp-admin auth user create --login=brian --password=redhat
User [brian] successfully created
$ pulp-admin auth role user add --role-id=super-users --login=brian
User [brian] successfully added to role [super-users]
$ pulp-admin auth role user remove --role-id=super-users --login=brian
An internal error occurred on the Pulp server:
RequestException: DELETE request
on /pulp/api/v2/roles/super-users/users/brian/ failed with 500 - 'permission'
When the -vv option was used I got
$ pulp-admin -vv auth role user remove --role-id=super-users --login=brian
2015-06-23 15:53:51,574 - DEBUG - sending DELETE request to /pulp/api/v2/roles/super-users/users/brian/
2015-06-23 15:53:51,642 - INFO - DELETE request to /pulp/api/v2/roles/super-users/users/brian/ with parameters None
2015-06-23 15:53:51,642 - INFO - Response status : 500
2015-06-23 15:53:51,642 - INFO - Response body :
{
"exception": [
"KeyError: 'permission'\n"
],
"traceback": [
" File \"/usr/lib/python2.7/site-packages/django/core/handlers/base.py\", line 112, in get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 69, in view\n return self.dispatch(request, *args, **kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 87, in dispatch\n return handler(request, *args, **kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 237, in _auth_decorator\n return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py\", line 191, in _verify_auth\n value = method(self, *args, **kwargs)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/views/roles.py\", line 228, in delete\n remove_user = role_manager.remove_user_from_role(role_id, login)\n",
" File \"/usr/lib/python2.7/site-packages/pulp/server/managers/auth/role/cud.py\", line 304, in remove_user_from_role\n item['permission'],\n"
],
"_href": "/pulp/api/v2/roles/super-users/users/brian/",
"error_message": "'permission'",
"http_request_method": "DELETE",
"http_status": 500
}
2015-06-23 15:53:51,643 - ERROR - Exception occurred:
href: /pulp/api/v2/roles/super-users/users/brian/
method: DELETE
status: 500
error: 'permission'
traceback: [u' File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n', u' File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view\n return self.dispatch(request, *args, **kwargs)\n', u' File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch\n return handler(request, *args, **kwargs)\n', u' File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 237, in _auth_decorator\n return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)\n', u' File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 191, in _verify_auth\n value = method(self, *args, **kwargs)\n', u' File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/roles.py", line 228, in delete\n remove_user = role_manager.remove_user_from_role(role_id, login)\n', u' File "/usr/lib/python2.7/site-packages/pulp/server/managers/auth/role/cud.py", line 304, in remove_user_from_role\n item[\'permission\'],\n']
data: {}
An internal error occurred on the Pulp server:
RequestException: DELETE request
on /pulp/api/v2/roles/super-users/users/brian/ failed with 500 - 'permission'
Here is the /var/log/messages
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: Unhandled Exception
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) 'permission'
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) Traceback (most recent call last):
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) response = wrapped_callback(request, *callback_args, **callback_kwargs)
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) return self.dispatch(request, *args, **kwargs)
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) return handler(request, *args, **kwargs)
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 237, in _auth_decorator
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 191, in _verify_auth
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) value = method(self, *args, **kwargs)
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/roles.py", line 228, in delete
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) remove_user = role_manager.remove_user_from_role(role_id, login)
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) File "/usr/lib/python2.7/site-packages/pulp/server/managers/auth/role/cud.py", line 304, in remove_user_from_role
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) item['permission'],
Jun 23 15:55:21 katello-kant pulp: pulp.server.webservices.middleware.exception:ERROR: (23037-04096) KeyError: 'permission'
Fixed: Unable to remove a user from super-user role
https://pulp.plan.io/issues/1078
closes #1078