Improve ping command tracing.
Change-Id: If2cd8e546c7f618b889397147111b12e85b4ff7a
This commit is contained in:
parent
3fc234c807
commit
835b1aa854
@ -111,12 +111,18 @@ def ping_ip_address(ip_address, should_succeed=True,
|
|||||||
LOG.debug('Execute ping command: %r', cmd_line)
|
LOG.debug('Execute ping command: %r', cmd_line)
|
||||||
proc = subprocess.Popen(cmd_line,
|
proc = subprocess.Popen(cmd_line,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
stdout, stderr = proc.communicate()
|
stdout, stderr = proc.communicate()
|
||||||
LOG.debug('Ping command exit status: %d', proc.returncode)
|
if proc.returncode == 0:
|
||||||
LOG.debug('Ping command stderr:\n%s', stderr)
|
LOG.debug("Ping command succeeded:\n"
|
||||||
LOG.debug('Ping command stdout:\n%s', stdout)
|
"stdout:\n%s\n"
|
||||||
|
"stderr:\n%s\n", stdout, stderr)
|
||||||
return (proc.returncode == 0) == should_succeed
|
return should_succeed
|
||||||
|
else:
|
||||||
|
LOG.debug("Ping command failed (exit_status=%d):\n"
|
||||||
|
"stdout:\n%s\n"
|
||||||
|
"stderr:\n%s\n", proc.returncode, stdout, stderr)
|
||||||
|
return not should_succeed
|
||||||
|
|
||||||
return test_utils.call_until_true(ping, timeout, 1)
|
return test_utils.call_until_true(ping, timeout, 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user