Dont log about skipping notification in normal case

Avoid logging about a missing resource for normal cases
where there is no resource in the request (e.g. HTTP GET's,
custom actions, etc).

Change-Id: I04c6b6737f238ca6250869b92e1d0771b4f95f22
Partial-Bug: #1707307
(cherry picked from commit f8fb73aa30)
This commit is contained in:
Kevin Benton 2017-09-19 12:18:48 -07:00 committed by Ihar Hrachyshka
parent 5b0191f524
commit 4cbf3153e8
1 changed files with 4 additions and 4 deletions

View File

@ -65,15 +65,15 @@ class NotifierHook(hooks.PecanHook):
resource_name = state.request.context.get('resource')
collection_name = state.request.context.get('collection')
neutron_context = state.request.context.get('neutron_context')
if not resource_name:
LOG.debug("Skipping NotifierHook processing as there was no "
"resource associated with the request")
return
action = pecan_constants.ACTION_MAP.get(state.request.method)
if not action or action not in ('create', 'update', 'delete'):
return
if utils.is_member_action(utils.get_controller(state)):
return
if not resource_name:
LOG.debug("Skipping NotifierHook processing as there was no "
"resource associated with the request")
return
if state.response.status_int > 300:
LOG.debug("No notification will be sent due to unsuccessful "
"status code: %s", state.response.status_int)