nova/neutron format integration is failed
Modify designate-sink formatv4/v6 parameter "project".
"tenant" key is not contain at "context" variable,
so I use "project_name" key.
And "context" dict object cannot use getattr function.
Change-Id: If485766a928bc2143b0b15afe99af38a6f927239
Closes-Bug: #1655581
(cherry picked from commit b23cae7b78
)
This commit is contained in:
parent
9c8bad11d9
commit
586db06757
|
@ -70,8 +70,8 @@ class NeutronFloatingHandler(base.BaseAddressHandler):
|
|||
'version': 4,
|
||||
'address': payload['floatingip']['floating_ip_address']
|
||||
}
|
||||
payload['floatingip']['project'] = getattr(
|
||||
context, 'tenant', None)
|
||||
payload['floatingip']['project'] = context.get(
|
||||
"project_name", None)
|
||||
self._create(addresses=[address],
|
||||
extra=payload['floatingip'],
|
||||
zone_id=zone_id,
|
||||
|
|
|
@ -65,7 +65,7 @@ class NovaFixedHandler(BaseAddressHandler):
|
|||
|
||||
zone_id = cfg.CONF[self.name].zone_id
|
||||
if event_type == 'compute.instance.create.end':
|
||||
payload['project'] = getattr(context, 'tenant', None)
|
||||
payload['project'] = context.get("project_name", None)
|
||||
self._create(addresses=payload['fixed_ips'],
|
||||
extra=payload,
|
||||
zone_id=zone_id,
|
||||
|
|
|
@ -52,7 +52,7 @@ class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
self.assertEqual(2, len(records))
|
||||
|
||||
self.plugin.process_notification(
|
||||
self.admin_context, event_type, fixture['payload'])
|
||||
self.admin_context.to_dict(), event_type, fixture['payload'])
|
||||
|
||||
# Ensure we now have exactly 1 record, plus SOA & NS
|
||||
records = self.central_service.find_records(self.admin_context,
|
||||
|
@ -64,7 +64,7 @@ class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
start_event_type = 'floatingip.update.end'
|
||||
start_fixture = self.get_notification_fixture(
|
||||
'neutron', start_event_type + '_associate')
|
||||
self.plugin.process_notification(self.admin_context,
|
||||
self.plugin.process_notification(self.admin_context.to_dict(),
|
||||
start_event_type,
|
||||
start_fixture['payload'])
|
||||
|
||||
|
@ -83,7 +83,7 @@ class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
self.assertEqual(4, len(records))
|
||||
|
||||
self.plugin.process_notification(
|
||||
self.admin_context, event_type, fixture['payload'])
|
||||
self.admin_context.to_dict(), event_type, fixture['payload'])
|
||||
|
||||
# Simulate the record having been deleted on the backend
|
||||
zone_serial = self.central_service.get_zone(
|
||||
|
@ -101,7 +101,7 @@ class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
start_event_type = 'floatingip.update.end'
|
||||
start_fixture = self.get_notification_fixture(
|
||||
'neutron', start_event_type + '_associate')
|
||||
self.plugin.process_notification(self.admin_context,
|
||||
self.plugin.process_notification(self.admin_context.to_dict(),
|
||||
start_event_type,
|
||||
start_fixture['payload'])
|
||||
|
||||
|
@ -119,7 +119,7 @@ class NeutronFloatingHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
self.assertEqual(4, len(records))
|
||||
|
||||
self.plugin.process_notification(
|
||||
self.admin_context, event_type, fixture['payload'])
|
||||
self.admin_context.to_dict(), event_type, fixture['payload'])
|
||||
|
||||
# Simulate the record having been deleted on the backend
|
||||
zone_serial = self.central_service.get_zone(
|
||||
|
|
|
@ -53,7 +53,7 @@ class NovaFixedHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
self.assertEqual(2, len(records))
|
||||
|
||||
self.plugin.process_notification(
|
||||
self.admin_context, event_type, fixture['payload'])
|
||||
self.admin_context.to_dict(), event_type, fixture['payload'])
|
||||
|
||||
# Ensure we now have exactly 1 more record
|
||||
records = self.central_service.find_records(self.admin_context,
|
||||
|
@ -83,7 +83,7 @@ class NovaFixedHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
self.assertEqual(2, len(recordsets))
|
||||
|
||||
self.plugin.process_notification(
|
||||
self.admin_context, event_type, fixture['payload'])
|
||||
self.admin_context.to_dict(), event_type, fixture['payload'])
|
||||
|
||||
# Ensure we now have exactly 1 more recordset
|
||||
recordsets = self.central_service.find_recordsets(
|
||||
|
@ -104,7 +104,7 @@ class NovaFixedHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
start_event_type = 'compute.instance.create.end'
|
||||
start_fixture = self.get_notification_fixture('nova', start_event_type)
|
||||
|
||||
self.plugin.process_notification(self.admin_context,
|
||||
self.plugin.process_notification(self.admin_context.to_dict(),
|
||||
start_event_type,
|
||||
start_fixture['payload'])
|
||||
|
||||
|
@ -123,7 +123,7 @@ class NovaFixedHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
self.assertEqual(4, len(records))
|
||||
|
||||
self.plugin.process_notification(
|
||||
self.admin_context, event_type, fixture['payload'])
|
||||
self.admin_context.to_dict(), event_type, fixture['payload'])
|
||||
|
||||
# Simulate the record having been deleted on the backend
|
||||
zone_serial = self.central_service.get_zone(
|
||||
|
@ -148,7 +148,8 @@ class NovaFixedHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
'create_record'):
|
||||
finder.return_value = {'id': 'fakeid'}
|
||||
self.plugin.process_notification(
|
||||
self.admin_context, event_type, fixture['payload'])
|
||||
self.admin_context.to_dict(),
|
||||
event_type, fixture['payload'])
|
||||
finder.assert_called_once_with(
|
||||
mock.ANY, type='A', zone_id=self.zone_id,
|
||||
name='private.example.com')
|
||||
|
@ -164,7 +165,8 @@ class NovaFixedHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
'create_record'):
|
||||
finder.return_value = {'id': 'fakeid'}
|
||||
self.plugin.process_notification(
|
||||
self.admin_context, event_type, fixture['payload'])
|
||||
self.admin_context.to_dict(),
|
||||
event_type, fixture['payload'])
|
||||
finder.assert_called_once_with(
|
||||
mock.ANY, type='A', zone_id=self.zone_id,
|
||||
name='private-v4.example.com')
|
||||
|
@ -182,7 +184,8 @@ class NovaFixedHandlerTest(TestCase, NotificationHandlerMixin):
|
|||
'create_record'):
|
||||
finder.return_value = {'id': 'fakeid'}
|
||||
self.plugin.process_notification(
|
||||
self.admin_context, event_type, fixture['payload'])
|
||||
self.admin_context.to_dict(),
|
||||
event_type, fixture['payload'])
|
||||
finder.assert_called_once_with(
|
||||
mock.ANY, type='A', zone_id=self.zone_id,
|
||||
name='private-v4.example.com')
|
||||
|
|
Loading…
Reference in New Issue