Merge "Use default_notification_level when notification"
This commit is contained in:
commit
7a11995421
@ -268,7 +268,7 @@ class Controller(object):
|
|||||||
notifier_api.notify(request.context,
|
notifier_api.notify(request.context,
|
||||||
self._publisher_id,
|
self._publisher_id,
|
||||||
self._resource + '.create.start',
|
self._resource + '.create.start',
|
||||||
notifier_api.INFO,
|
notifier_api.CONF.default_notification_level,
|
||||||
body)
|
body)
|
||||||
body = Controller.prepare_request_body(request.context, body, True,
|
body = Controller.prepare_request_body(request.context, body, True,
|
||||||
self._resource, self._attr_info,
|
self._resource, self._attr_info,
|
||||||
@ -313,7 +313,7 @@ class Controller(object):
|
|||||||
notifier_api.notify(request.context,
|
notifier_api.notify(request.context,
|
||||||
self._publisher_id,
|
self._publisher_id,
|
||||||
self._resource + '.create.end',
|
self._resource + '.create.end',
|
||||||
notifier_api.INFO,
|
notifier_api.CONF.default_notification_level,
|
||||||
create_result)
|
create_result)
|
||||||
return create_result
|
return create_result
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ class Controller(object):
|
|||||||
notifier_api.notify(request.context,
|
notifier_api.notify(request.context,
|
||||||
self._publisher_id,
|
self._publisher_id,
|
||||||
self._resource + '.delete.start',
|
self._resource + '.delete.start',
|
||||||
notifier_api.INFO,
|
notifier_api.CONF.default_notification_level,
|
||||||
{self._resource + '_id': id})
|
{self._resource + '_id': id})
|
||||||
action = self._plugin_handlers[self.DELETE]
|
action = self._plugin_handlers[self.DELETE]
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ class Controller(object):
|
|||||||
notifier_api.notify(request.context,
|
notifier_api.notify(request.context,
|
||||||
self._publisher_id,
|
self._publisher_id,
|
||||||
self._resource + '.delete.end',
|
self._resource + '.delete.end',
|
||||||
notifier_api.INFO,
|
notifier_api.CONF.default_notification_level,
|
||||||
{self._resource + '_id': id})
|
{self._resource + '_id': id})
|
||||||
|
|
||||||
def update(self, request, id, body=None, **kwargs):
|
def update(self, request, id, body=None, **kwargs):
|
||||||
@ -374,7 +374,7 @@ class Controller(object):
|
|||||||
notifier_api.notify(request.context,
|
notifier_api.notify(request.context,
|
||||||
self._publisher_id,
|
self._publisher_id,
|
||||||
self._resource + '.update.start',
|
self._resource + '.update.start',
|
||||||
notifier_api.INFO,
|
notifier_api.CONF.default_notification_level,
|
||||||
payload)
|
payload)
|
||||||
body = Controller.prepare_request_body(request.context, body, False,
|
body = Controller.prepare_request_body(request.context, body, False,
|
||||||
self._resource, self._attr_info,
|
self._resource, self._attr_info,
|
||||||
@ -409,7 +409,7 @@ class Controller(object):
|
|||||||
notifier_api.notify(request.context,
|
notifier_api.notify(request.context,
|
||||||
self._publisher_id,
|
self._publisher_id,
|
||||||
self._resource + '.update.end',
|
self._resource + '.update.end',
|
||||||
notifier_api.INFO,
|
notifier_api.CONF.default_notification_level,
|
||||||
result)
|
result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -732,7 +732,8 @@ class V2Views(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class NotificationTest(APIv2TestBase):
|
class NotificationTest(APIv2TestBase):
|
||||||
def _resource_op_notifier(self, opname, resource, expected_errors=False):
|
def _resource_op_notifier(self, opname, resource, expected_errors=False,
|
||||||
|
notification_level='INFO'):
|
||||||
initial_input = {resource: {'name': 'myname'}}
|
initial_input = {resource: {'name': 'myname'}}
|
||||||
instance = self.plugin.return_value
|
instance = self.plugin.return_value
|
||||||
instance.get_networks.return_value = initial_input
|
instance.get_networks.return_value = initial_input
|
||||||
@ -757,12 +758,12 @@ class NotificationTest(APIv2TestBase):
|
|||||||
expected = [mock.call(mock.ANY,
|
expected = [mock.call(mock.ANY,
|
||||||
'network.' + cfg.CONF.host,
|
'network.' + cfg.CONF.host,
|
||||||
resource + "." + opname + ".start",
|
resource + "." + opname + ".start",
|
||||||
'INFO',
|
notification_level,
|
||||||
mock.ANY),
|
mock.ANY),
|
||||||
mock.call(mock.ANY,
|
mock.call(mock.ANY,
|
||||||
'network.' + cfg.CONF.host,
|
'network.' + cfg.CONF.host,
|
||||||
resource + "." + opname + ".end",
|
resource + "." + opname + ".end",
|
||||||
'INFO',
|
notification_level,
|
||||||
mock.ANY)]
|
mock.ANY)]
|
||||||
self.assertEqual(expected, mynotifier.call_args_list)
|
self.assertEqual(expected, mynotifier.call_args_list)
|
||||||
self.assertEqual(res.status_int, expected_code)
|
self.assertEqual(res.status_int, expected_code)
|
||||||
@ -776,6 +777,11 @@ class NotificationTest(APIv2TestBase):
|
|||||||
def test_network_update_notifer(self):
|
def test_network_update_notifer(self):
|
||||||
self._resource_op_notifier('update', 'network')
|
self._resource_op_notifier('update', 'network')
|
||||||
|
|
||||||
|
def test_network_create_notifer(self):
|
||||||
|
cfg.CONF.set_override('default_notification_level', 'DEBUG')
|
||||||
|
self._resource_op_notifier('create', 'network',
|
||||||
|
notification_level='DEBUG')
|
||||||
|
|
||||||
|
|
||||||
class QuotaTest(APIv2TestBase):
|
class QuotaTest(APIv2TestBase):
|
||||||
def test_create_network_quota(self):
|
def test_create_network_quota(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user