pycadf doesn't work when service catalog is not set

Bug #1397938 reported by Divya K Konoor
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
pycadf
In Progress
High
Unassigned

Bug Description

pycadf middleware throws the following exception when it doesn't find service catalog in the request header.

776 ERROR pycadf.middleware.notifier [req-cd3fd550-48d3-43a4-b3a7-08e47a0b39e4 None] An exception occurred processing the API call: 'HTTP_X_SERVICE_CATALOG'
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier Traceback (most recent call last):
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier File "/usr/lib/python2.6/site-packages/pycadf/middleware/notifier.py", line 36, in wrapped
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier return fn(*args, **kwargs)
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier File "/usr/lib/python2.6/site-packages/pycadf/middleware/audit.py", line 35, in process_request
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier self.cadf_audit.append_audit_event(request)
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier File "/usr/lib/python2.6/site-packages/pycadf/audit/api.py", line 282, in append_audit_event
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier event = self.create_event(req, correlation_id)
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier File "/usr/lib/python2.6/site-packages/pycadf/audit/api.py", line 217, in create_event
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier catalog = ast.literal_eval(req.environ['HTTP_X_SERVICE_CATALOG'])
2014-11-28 01:02:34.526 776 TRACE pycadf.middleware.notifier KeyError: 'HTTP_X_SERVICE_CATALOG'

This is especially true if the attribute 'include_service_catalog' is set to 'false' . The include_service_catalog is used by the keystonemiddleware . If include_service_catalog is set to false, the keystonemiddleware doesn't set the service catalog.

To replicate this problem, I did the following :

In /etc/nova/nova.conf file , I set this:
include_service_catalog = false

In /etc/nova/api-paste.ini, I enabled the audit middleware:
keystone = request_id faultwrap sizelimit authtoken keystonecontext audit osapi_compute_app_v21

[filter:audit]
paste.filter_factory = pycadf.middleware.audit:AuditMiddleware.factory
service_name = <ipaddress>:8774

Try some rest call like the below:
https://ip9-114-225-236.pok.stglabs.ibm.com/powervc/openstack/compute/v2/03170c763efa4de98ad0b444d96a5b24/servers

The above affects the capability to use auditing along with include_service_catalog = false

Tags: audit
Revision history for this message
gordon chung (chungg) wrote :

i think we can add an option(s) similar to service_name option we pass in above...

i'm thinking maybe:

 target_service_name
 target_service_type
 target_service_xxxx

where if anyone is defined. we consider it a service_catalog override and we'll just build service info based on given options rather than attempting to search service_catalog.

Revision history for this message
gordon chung (chungg) wrote :

i should clarify, i'm not really adament whether we capture these override opts in conf files or pass in via paste.

we should probably add a check which just skips everything if no service catalog and no override is given.

Revision history for this message
gordon chung (chungg) wrote :

i'm using changing this to the above where i will add a "enable_discovery" option -- true by default -- which will function as it currently does (using service catalog).

if false, it will look into conf file which should have defaults defined.

Changed in pycadf:
assignee: nobody → gordon chung (chungg)
importance: Undecided → High
status: New → In Progress
gordon chung (chungg)
Changed in pycadf:
assignee: gordon chung (chungg) → nobody
Revision history for this message
Steve Martinelli (stevemar) wrote :
Revision history for this message
gordon chung (chungg) wrote :

i think this is when there is no service catalog at all... is that possible?

Revision history for this message
Steve Martinelli (stevemar) wrote :

do we support a use case where there is no service catalog? templated or sql based?

Revision history for this message
Nathan Oyler (notq) wrote :

Ran into this error, any update on progress?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.