1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-12 07:58:07 +00:00

Merge pull request #196 from bjackman/is-network-connected

target: Ensure returning False when is_network_connected fails
This commit is contained in:
setrofim 2017-10-24 16:29:17 +01:00 committed by GitHub
commit af0ed2ab48

View File

@ -715,7 +715,8 @@ class Target(object):
# We'll use our own retrying mechanism (rather than just using ping's -c # We'll use our own retrying mechanism (rather than just using ping's -c
# to send multiple packets) so that we don't slow things down in the # to send multiple packets) so that we don't slow things down in the
# 'good' case where the first packet gets echoed really quickly. # 'good' case where the first packet gets echoed really quickly.
for _ in range(5): attempts = 5
for _ in range(attempts):
try: try:
self.execute(command) self.execute(command)
return True return True
@ -737,6 +738,10 @@ class Target(object):
# error. # error.
raise raise
self.logger.debug('Failed to ping {} after {} attempts'.format(
GOOGLE_DNS_SERVER_ADDRESS, attempts))
return False
class LinuxTarget(Target): class LinuxTarget(Target):
path = posixpath path = posixpath