non-admin users raise KeyError u'project_id'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Important note: this occurred post-upgrade from essex to folsom. I'm using the CentOS packages provided by EPEL.
steps:
1) obtain an auth-token
curl -H 'Content-Type: application/json' -d '{ "auth": {"tenantName": "Development", "passwordCreden
"access": {"token": {"expires": "2013-02-
2) attempt to list servers for a tenant
curl -v -H 'X-Auth-Token: e3d266a113a6455
Expected:
A list of servers for the Development tenant.
Actual:
Reply from server:
http://
* About to connect() to 10.0.80.15 port 8774 (#0)
* Trying 10.0.80.15...
* connected
* Connected to 10.0.80.15 (10.0.80.15) port 8774 (#0)
> GET /v2/2201915216d
> User-Agent: curl/7.24.0 (x86_64-
> Host: 10.0.80.15:8774
> Accept: */*
> X-Auth-Token: e3d266a113a6455
>
< HTTP/1.1 500 Internal Server Error
< Content-Length: 128
< Content-Type: application/json; charset=UTF-8
< Date: Wed, 06 Feb 2013 15:24:38 GMT
<
* Connection #0 to host 10.0.80.15 left intact
{"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}* Closing connection #0
Stack trace:
2013-02-05 16:01:31 6291 ERROR nova.api.openstack [-] Caught error: u'project_id'
2013-02-05 16:01:31 6291 TRACE nova.api.openstack Traceback (most recent call last):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return req.get_
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack application, catch_exc_
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack app_iter = application(
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return resp(environ, start_response)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return self.app(env, start_response)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack service_
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack self.is_admin = policy.
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack exception.
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack if not _BRAIN.
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack for item in and_list]):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return func(self, match_kind, match_value, target_dict, cred_dict)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return brain.check(
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack for item in and_list]):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return func(self, match_kind, match_value, target_dict, cred_dict)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return brain.check(
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack for item in and_list]):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return func(self, match_kind, match_value, target_dict, cred_dict)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return brain.check(
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack for item in and_list]):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 ERROR nova.api.openstack [-] Caught error: u'project_id'
2013-02-05 16:01:31 6291 TRACE nova.api.openstack Traceback (most recent call last):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return req.get_
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack application, catch_exc_
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack app_iter = application(
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return resp(environ, start_response)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return self.app(env, start_response)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack service_
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack self.is_admin = policy.
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack exception.
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack if not _BRAIN.
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack for item in and_list]):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return func(self, match_kind, match_value, target_dict, cred_dict)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return brain.check(
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack for item in and_list]):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return func(self, match_kind, match_value, target_dict, cred_dict)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return brain.check(
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack for item in and_list]):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return func(self, match_kind, match_value, target_dict, cred_dict)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return brain.check(
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack for item in and_list]):
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack return func(self, match_kind, match_value, target_dict, cred_dict)
2013-02-05 16:01:31 6291 TRACE nova.api.openstack File "/usr/lib/
2013-02-05 16:01:31 6291 TRACE nova.api.openstack match = match % target_dict
2013-02-05 16:01:31 6291 TRACE nova.api.openstack KeyError: u'project_id'
This may be a config problem on my end, but regardless this error is pretty obfuscated. I've tracked it down to an empty target_dict being passed in to _check_generic via the policy.is_admin check. It does directly seem to be related to my policy.json for the nova service, which has the following default_rule:
"admin_
"default": [["rule:
Changing project_
ERROR: Policy doesn't allow compute:
My full policy.json:
{
"admin_
"default": [["rule:
"compute:
"compute:
"compute:
"compute:
"admin_api": [["role:admin"]],
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"compute_
"volume:
"volume:
"volume:
"volume:
"volume:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
"network:
}
I doubt this is a correct workaround, but a simple try/catch for the KeyError in _check_generic resolved this issue for me.