From 159127034116d406888527bc92546c9cc705bf1a Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Thu, 18 Feb 2021 15:19:03 +0800 Subject: [PATCH] Optimize subscription creating handler return 404 in case of nodeinfo is not available Story: 2008529 Task: 41873 Signed-off-by: Bin Yang Change-Id: I551680c19496841c14101f4a465cb932e40adf08 --- .../notificationclientsdk/services/ptp.py | 10 ++-------- .../sidecar/controllers/v1/subscriptions.py | 4 ---- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/notificationclient-base/centos/docker/notificationclient-sidecar/notificationclientsdk/services/ptp.py b/notificationclient-base/centos/docker/notificationclient-sidecar/notificationclientsdk/services/ptp.py index d627daf..0916a79 100644 --- a/notificationclient-base/centos/docker/notificationclient-sidecar/notificationclientsdk/services/ptp.py +++ b/notificationclient-base/centos/docker/notificationclient-sidecar/notificationclientsdk/services/ptp.py @@ -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: diff --git a/notificationclient-base/centos/docker/notificationclient-sidecar/sidecar/controllers/v1/subscriptions.py b/notificationclient-base/centos/docker/notificationclient-sidecar/sidecar/controllers/v1/subscriptions.py index 7558719..e970db6 100644 --- a/notificationclient-base/centos/docker/notificationclient-sidecar/sidecar/controllers/v1/subscriptions.py +++ b/notificationclient-base/centos/docker/notificationclient-sidecar/sidecar/controllers/v1/subscriptions.py @@ -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)