Make sure amphora logging works the same on py2 and py3
In Python 3.3 IOError is just an alias of OSError. This causes logging in a very specific scenario to not log the appropriate message, as one code path is unreachable. This is fixed in this patch by merging the two exception paths. Story: 2005576 Task: 30765 Change-Id: Ie81de8e85753fde1516aea0b084df6a0c513ad7b
This commit is contained in:
parent
57d653cc63
commit
0000412cf4
|
@ -66,7 +66,6 @@ def run_sender(cmd_queue):
|
|||
keepalived_pid_path = util.keepalived_pid_path()
|
||||
|
||||
while True:
|
||||
|
||||
try:
|
||||
# If the keepalived config file is present check
|
||||
# that it is running, otherwise don't send the health
|
||||
|
@ -79,18 +78,13 @@ def run_sender(cmd_queue):
|
|||
|
||||
message = build_stats_message()
|
||||
sender.dosend(message)
|
||||
|
||||
except IOError as e:
|
||||
# Missing PID file, skip health heartbeat
|
||||
except (IOError, OSError) as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
# Missing PID file, skip health heartbeat.
|
||||
LOG.error('Missing keepalived PID file %s, skipping health '
|
||||
'heartbeat.', keepalived_pid_path)
|
||||
else:
|
||||
LOG.error('Failed to check keepalived and haproxy status due '
|
||||
'to exception %s, skipping health heartbeat.', e)
|
||||
except OSError as e:
|
||||
# Keepalived is not running, skip health heartbeat
|
||||
if e.errno == errno.ESRCH:
|
||||
elif e.errno == errno.ESRCH:
|
||||
# Keepalived is not running, skip health heartbeat.
|
||||
LOG.error('Keepalived is configured but not running, '
|
||||
'skipping health heartbeat.')
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue