Add sg name in after delete event kwargs

Allow the subscriber to know the deleted security group name. It can
help some downstream callback utilization to use the deleted sg name for
additional workflow.

Change-Id: Ia321ff96cf445d20f082779d3f6a96fac07b0943
This commit is contained in:
Hang Yang 2020-05-14 15:59:56 -05:00
parent cb55643a06
commit a2561fa480
2 changed files with 3 additions and 1 deletions

View File

@ -272,6 +272,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase,
sg.delete()
kwargs.pop('security_group')
kwargs['name'] = sg['name']
registry.notify(resources.SECURITY_GROUP, events.AFTER_DELETE,
self, **kwargs)

View File

@ -371,7 +371,8 @@ class SecurityGroupDbMixinTestCase(testlib_api.SqlTestCase):
mock.call('security_group', 'after_delete',
mock.ANY, context=mock.ANY,
security_group_id=sg_dict['id'],
security_group_rule_ids=[mock.ANY, mock.ANY])])
security_group_rule_ids=[mock.ANY, mock.ANY],
name=sg_dict['name'])])
def test_security_group_rule_precommit_create_event_fail(self):
registry.subscribe(fake_callback, resources.SECURITY_GROUP_RULE,