Fix neutron client to catch 404 exceptions

When network services such as lbaas, fwaas or vpnaas are disabled
in neutron, the discovery continues to poll the api calls and gets
back a not found exception. The fix here is to catch the exception
so it doesn't go unhandled.

Change-Id: I8f350b9009f0d8c172836b1dd1123e966f887fdb
Closes-Bug: #1374012
(cherry picked from commit b65554eb46)
This commit is contained in:
Pradeep Kilambi 2014-09-30 11:24:20 -07:00 committed by Eoghan Glynn
parent 8b61fdd2db
commit aa15b2d7ed
1 changed files with 5 additions and 0 deletions

View File

@ -16,6 +16,7 @@
import functools
from neutronclient.common import exceptions
from neutronclient.v2_0 import client as clientv20
from oslo.config import cfg
@ -40,6 +41,10 @@ def logged(func):
def with_logging(*args, **kwargs):
try:
return func(*args, **kwargs)
except exceptions.NeutronClientException as e:
# handles 404's when services are disabled in neutron
LOG.warn(e)
return []
except Exception as e:
LOG.exception(e)
raise