Notif handlers:remove double check of event type
Change Id50a4a42a8dddbffb85b5fbca43f1b7f31447874 made the call to handler's process_notification to happen only on registered event types. There's not need to check the event type inside the handler itself. Also remove the unit test because the part of the code that is tested is never executed. Change-Id: I75e204d5ff44d3dd0100393a98cc2537886eaa05
This commit is contained in:
parent
22436ffa3d
commit
dcb58846a6
@ -55,13 +55,6 @@ class NeutronFloatingHandler(BaseAddressHandler):
|
||||
LOG.debug('%s received notification - %s' %
|
||||
(self.get_canonical_name(), event_type))
|
||||
|
||||
# FIXME: Neutron doesn't send ipv in the payload, should maybe
|
||||
# determine this?
|
||||
if event_type not in self.get_event_types():
|
||||
msg = '%s received an invalid event type %s' % (
|
||||
self, event_type)
|
||||
raise ValueError(msg)
|
||||
|
||||
if event_type.startswith('floatingip.delete'):
|
||||
self._delete(resource_id=payload['floatingip_id'],
|
||||
resource_type='floatingip')
|
||||
|
@ -62,5 +62,3 @@ class NovaFixedHandler(BaseAddressHandler):
|
||||
elif event_type == 'compute.instance.delete.start':
|
||||
self._delete(resource_id=payload['instance_id'],
|
||||
resource_type='instance')
|
||||
else:
|
||||
raise ValueError('NovaFixedHandler received an invalid event type')
|
||||
|
@ -16,9 +16,6 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
import testtools
|
||||
|
||||
from designate.context import DesignateContext
|
||||
from designate.tests import resources
|
||||
|
||||
|
||||
@ -34,14 +31,3 @@ class NotificationHandlerMixin(object):
|
||||
|
||||
with open(filename, 'r') as fh:
|
||||
return json.load(fh)
|
||||
|
||||
def test_invalid_event_type(self):
|
||||
context = DesignateContext.get_admin_context(all_tenants=True)
|
||||
if not hasattr(self, 'plugin'):
|
||||
raise NotImplementedError
|
||||
event_type = 'invalid'
|
||||
|
||||
self.assertNotIn(event_type, self.plugin.get_event_types())
|
||||
|
||||
with testtools.ExpectedException(ValueError):
|
||||
self.plugin.process_notification(context, event_type, 'payload')
|
||||
|
Loading…
Reference in New Issue
Block a user