Optimize subscription creating handler
return 404 in case of nodeinfo is not available Story: 2008529 Task: 41873 Signed-off-by: Bin Yang <bin.yang@windriver.com> Change-Id: I551680c19496841c14101f4a465cb932e40adf08
This commit is contained in:
parent
4481a7f00c
commit
1591270341
@ -65,14 +65,8 @@ class PtpService(object):
|
||||
nodeinfos = NodeInfoHelper.enumerate_nodes(broker_node_name)
|
||||
# check node availability from DB
|
||||
if not nodeinfos or not default_node_name in nodeinfos:
|
||||
# update nodeinfo
|
||||
try:
|
||||
nodeinfo = self.locationservice_client.update_location(
|
||||
default_node_name, timeout=5, retry=2)
|
||||
except oslo_messaging.exceptions.MessagingTimeout as ex:
|
||||
LOG.warning("node {0} cannot be reached due to {1}".format(
|
||||
default_node_name, str(ex)))
|
||||
raise client_exception.NodeNotAvailable(broker_node_name)
|
||||
LOG.warning("Node {0} is not available yet".format(default_node_name))
|
||||
raise client_exception.NodeNotAvailable(broker_node_name)
|
||||
|
||||
# get initial resource status
|
||||
if default_node_name:
|
||||
|
@ -6,8 +6,6 @@ from webob.exc import HTTPException, HTTPNotFound, HTTPBadRequest, HTTPClientErr
|
||||
import os
|
||||
import logging
|
||||
|
||||
import oslo_messaging
|
||||
|
||||
from wsme import types as wtypes
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
@ -72,8 +70,6 @@ class SubscriptionsController(rest.RestController):
|
||||
abort(404)
|
||||
except client_exception.ResourceNotAvailable as ex:
|
||||
abort(404)
|
||||
except oslo_messaging.exceptions.MessagingTimeout as ex:
|
||||
abort(404)
|
||||
except HTTPException as ex:
|
||||
LOG.warning("Client side error:{0},{1}".format(type(ex), str(ex)))
|
||||
abort(400)
|
||||
|
Loading…
Reference in New Issue
Block a user