diff options
author | Brendan Jackman <brendan.jackman@arm.com> | 2017-10-24 16:03:10 +0100 |
---|---|---|
committer | Brendan Jackman <brendan.jackman@arm.com> | 2017-10-24 16:05:05 +0100 |
commit | 417ab3df3e292393bd6c75046091815ade575f79 (patch) | |
tree | 40e6f0ab2dab3ee725276731cc19707dc745ff48 | |
parent | 486b3f524e6b2e7baf3e12446dfe9125d69c88b7 (diff) | |
download | devlib-417ab3df3e292393bd6c75046091815ade575f79.tar.gz |
target: Ensure returning False when is_network_connected fails
-rw-r--r-- | devlib/target.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/devlib/target.py b/devlib/target.py index 1d2754f..aea3331 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -715,7 +715,8 @@ class Target(object): # 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 # 'good' case where the first packet gets echoed really quickly. - for _ in range(5): + attempts = 5 + for _ in range(attempts): try: self.execute(command) return True @@ -737,6 +738,10 @@ class Target(object): # error. raise + self.logger.debug('Failed to ping {} after {} attempts'.format( + GOOGLE_DNS_SERVER_ADDRESS, attempts)) + return False + class LinuxTarget(Target): path = posixpath |