summaryrefslogtreecommitdiff
path: root/src/leap/base/checks.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-12-07 02:23:09 +0900
committerkali <kali@leap.se>2012-12-07 02:23:09 +0900
commitc963fcf443fec18c46aa40801436533f60ebbe57 (patch)
treefec0a56c64f1120aa064d824bc2427aa8ca91899 /src/leap/base/checks.py
parentfa59d347e82e3ddfb758658e15bf8a2d8e3d83b1 (diff)
parent4c2f68b1158f3840f33a38a81a5fc03495d28466 (diff)
Merge branch 'feature/improve_coverage' into develop
Diffstat (limited to 'src/leap/base/checks.py')
-rw-r--r--src/leap/base/checks.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/leap/base/checks.py b/src/leap/base/checks.py
index 23446f4a..dc2602c2 100644
--- a/src/leap/base/checks.py
+++ b/src/leap/base/checks.py
@@ -39,9 +39,6 @@ class LeapNetworkChecker(object):
# XXX remove this hardcoded random ip
# ping leap.se or eip provider instead...?
requests.get('http://216.172.161.165')
-
- except (requests.HTTPError, requests.RequestException) as e:
- raise exceptions.NoInternetConnection(e.message)
except requests.ConnectionError as e:
error = "Unidentified Connection Error"
if e.message == "[Errno 113] No route to host":
@@ -51,11 +48,17 @@ class LeapNetworkChecker(object):
error = "Provider server appears to be down."
logger.error(error)
raise exceptions.NoInternetConnection(error)
+ except (requests.HTTPError, requests.RequestException) as e:
+ raise exceptions.NoInternetConnection(e.message)
logger.debug('Network appears to be up.')
def is_internet_up(self):
iface, gateway = self.get_default_interface_gateway()
- self.ping_gateway(self.provider_gateway)
+ try:
+ self.ping_gateway(self.provider_gateway)
+ except exceptions.NoConnectionToGateway:
+ return False
+ return True
def check_tunnel_default_interface(self):
"""