Log output and exception when traceroute fails
These traceroutes currently fail in a very opaque way. We are occasionally seeing Fedora nodes fail in here (which is odd, because obviously networking is up enough for zuul to connect) and don't have much to go on. When an exception is caught, add the output, return code and basic traceback to the return attributes, and include them in the failure case. Depends-On: https://review.openstack.org/563702 Change-Id: I047bf2b1daa22a5b6bfc12b3f42b108975097409
This commit is contained in:
parent
fbb58ddfde
commit
b02035f429
@ -18,6 +18,7 @@
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import traceback
|
||||
|
||||
|
||||
command_map = {
|
||||
@ -68,19 +69,25 @@ def main():
|
||||
ret['traceroute_v6'] = run_command(
|
||||
'traceroute6 -n {host}'.format(host=traceroute_host))
|
||||
passed = True
|
||||
except (subprocess.CalledProcessError, OSError):
|
||||
except (subprocess.CalledProcessError, OSError) as e:
|
||||
ret['traceroute_v6_exception'] = traceback.format_exc(e)
|
||||
ret['traceroute_v6_output'] = e.output
|
||||
ret['traceroute_v6_return'] = e.returncode
|
||||
pass
|
||||
try:
|
||||
ret['traceroute_v4'] = run_command(
|
||||
'traceroute -n {host}'.format(host=traceroute_host))
|
||||
passed = True
|
||||
except (subprocess.CalledProcessError, OSError):
|
||||
except (subprocess.CalledProcessError, OSError) as e:
|
||||
ret['traceroute_v4_exception'] = traceback.format_exc(e)
|
||||
ret['traceroute_v4_output'] = e.output
|
||||
ret['traceroute_v4_return'] = e.returncode
|
||||
pass
|
||||
if not passed:
|
||||
module.fail_json(
|
||||
msg="No viable v4 or v6 route found to {traceroute_host}."
|
||||
" The build node is assumed to be invalid.".format(
|
||||
traceroute_host=traceroute_host))
|
||||
traceroute_host=traceroute_host), **ret)
|
||||
|
||||
for key, command in command_map.items():
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user