From 5227491b8abfdabe8d6c3625f2bb544cc7cfb7e8 Mon Sep 17 00:00:00 2001 From: Bence Romsics Date: Wed, 21 Nov 2018 17:07:55 +0100 Subject: [PATCH] Placement client: do not swallow exceptions Placement client unconditionally swallowed many exceptions. I cannot tell why that was ever considered a good idea. I can imagine some users wanting to ignore some of those error conditions, but it should be the responsibility of the user to decide. The client should not unconditionally ignore all errors, but leave this choice for the user of the client. Particularly this placement client will be used by later patches for minimum-bandwidth-allocation-placement-api where we do want to know about some of these errors and retry placement operations when they fail. Change-Id: Ia14ba8cb273166fe3075328229f30d0cebae0480 Related-Bug: #1578989 --- neutron_lib/placement/client.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/neutron_lib/placement/client.py b/neutron_lib/placement/client.py index 280682b5e..b17c5fa22 100644 --- a/neutron_lib/placement/client.py +++ b/neutron_lib/placement/client.py @@ -43,22 +43,9 @@ def _check_placement_api_available(f): """ @functools.wraps(f) def wrapper(self, *a, **k): - try: - if not self._client: - self._client = self._create_client() - return f(self, *a, **k) - except ks_exc.EndpointNotFound: - LOG.warning('Please enable the placement service.') - except ks_exc.MissingAuthPlugin: - LOG.warning('No authentication information found for placement ' - 'API. Please enable the placement service.') - except ks_exc.Unauthorized: - LOG.warning('Placement service credentials do not work. ' - 'Please enable the placement service.') - except ks_exc.DiscoveryFailure: - LOG.warning('Discovering suitable URL for placement API failed.') - except ks_exc.ConnectFailure: - LOG.warning('Placement API service is not responding.') + if not self._client: + self._client = self._create_client() + return f(self, *a, **k) return wrapper