Policy is not initialized in designate-api

Bug #1366766 reported by Kiall Mac Innes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Fix Released
High
Kiall Mac Innes

Bug Description

Policy is not initialized in designate-api, resulting in failures to any policy.enforce() call similar to:

2014-09-08 10:11:58.360 INFO designate.policy [-] Policy check failed for rule 'all_tenants' on target {}
2014-09-08 10:11:58.361 ERROR oslo.messaging.notify.dispatcher [-] Exception during message handling
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher Traceback (most recent call last):
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo/messaging/notify/dispatcher.py", line 85, in _dispatch_and_handle_error
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher return self._dispatch(incoming.ctxt, incoming.message)
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo/messaging/notify/dispatcher.py", line 121, in _dispatch
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher metadata)
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/opt/stack/designate/designate/sink/service.py", line 114, in info
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher handler.process_notification(context, event_type, payload)
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/opt/stack/designate/designate/notification_handler/nova.py", line 60, in process_notification
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher resource_type='instance')
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/opt/stack/designate/designate/notification_handler/base.py", line 122, in _create
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher domain = self.get_domain(cfg.CONF[self.name].domain_id)
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/opt/stack/designate/designate/notification_handler/base.py", line 80, in get_domain
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher context = DesignateContext.get_admin_context(all_tenants=True)
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/opt/stack/designate/designate/context.py", line 104, in get_admin_context
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher return cls(None, **kwargs)
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/opt/stack/designate/designate/context.py", line 57, in __init__
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher self.all_tenants = all_tenants
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/opt/stack/designate/designate/context.py", line 128, in all_tenants
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher policy.check('all_tenants', self)
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher File "/opt/stack/designate/designate/policy.py", line 86, in check
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher result = _ENFORCER.enforce(rule, target, creds, do_raise, exc)
2014-09-08 10:11:58.361 TRACE oslo.messaging.notify.dispatcher AttributeError: 'NoneType' object has no attribute 'enforce'

Changed in designate:
assignee: nobody → Kiall Mac Innes (kiall)
status: Confirmed → In Progress
Revision history for this message
Kiall Mac Innes (kiall) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (master)

Reviewed: https://review.openstack.org/119737
Committed: https://git.openstack.org/cgit/openstack/designate/commit/?id=66a1ea920d1e847af48cc49f3a331f940daa2be2
Submitter: Jenkins
Branch: master

commit 66a1ea920d1e847af48cc49f3a331f940daa2be2
Author: Kiall Mac Innes <email address hidden>
Date: Mon Sep 8 12:34:47 2014 +0100

    Ensure designate-api has policy initialized

    We create a new WSGIService class, which inherits from both
    the base designate Service class, and the openstack-common
    wsgi.Service class.

    This allows our common service initialization code to be
    executed.

    Closes-Bug: 1366766
    Change-Id: I60ed6222a1e9bd54329545767ee329b54876e73a

Changed in designate:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in designate:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in designate:
milestone: juno-rc1 → 2014.2
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.