Add requests.ConnectionError to watcher retries
Apparently with switch to Python 3, requests library raises a different exception when read time out occurrs and it's quite general requests.ConnectionError. This causes tracebacks like [1] to show up in logs. This is pretty scary for the user, so this commit suppresses those exceptions and adds them to the list of exceptions K8sClient restarts watching. [1] http://paste.openstack.org/show/786574/ Change-Id: I09f3803edffbe2ea5f1913238adc23212a323100
This commit is contained in:
@@ -271,7 +271,8 @@ class K8sClient(object):
|
|||||||
# At this point it's safely passed to handler.
|
# At this point it's safely passed to handler.
|
||||||
m = line_dict.get('object', {}).get('metadata', {})
|
m = line_dict.get('object', {}).get('metadata', {})
|
||||||
resource_version = m.get('resourceVersion', None)
|
resource_version = m.get('resourceVersion', None)
|
||||||
except (requests.ReadTimeout, ssl.SSLError) as e:
|
except (requests.ReadTimeout, requests.ConnectionError,
|
||||||
|
ssl.SSLError) as e:
|
||||||
if isinstance(e, ssl.SSLError) and e.args != ('timed out',):
|
if isinstance(e, ssl.SSLError) and e.args != ('timed out',):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user