summaryrefslogtreecommitdiff
path: root/src/leap/eip/checks.py
diff options
context:
space:
mode:
authorantialias <antialias@leap.se>2012-09-24 17:34:25 -0400
committerantialias <antialias@leap.se>2012-09-24 17:34:25 -0400
commitddf5e546916ad94c62b1e42b6f03831f906b2f29 (patch)
tree6b284d81d9632819302a028320785339b45a725d /src/leap/eip/checks.py
parenta5366ebc06a1345f9248672e91cf87379d3bcec1 (diff)
improved network checks on the way to a network checker.
Diffstat (limited to 'src/leap/eip/checks.py')
-rw-r--r--src/leap/eip/checks.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/leap/eip/checks.py b/src/leap/eip/checks.py
index 9b7b1cee..82940fd3 100644
--- a/src/leap/eip/checks.py
+++ b/src/leap/eip/checks.py
@@ -70,21 +70,20 @@ class LeapNetworkChecker(object):
checker.is_internet_up()
checker.ping_gateway()
- def test_internet_connection(self):
- # XXX we're not passing the error anywhere.
- # XXX we probably should raise an exception here?
- # unless we use this as smoke test
+ def check_internet_connection(self):
try:
# XXX remove this hardcoded random ip
requests.get('http://216.172.161.165')
except (requests.HTTPError, requests.RequestException) as e:
- self.error = e.message
- except requests.ConenctionError as e:
+ raise eipexceptions.NoInternetConnection(e.message)
+ except requests.ConnectionError as e:
+ error = "Unidentified Connection Error"
if e.message == "[Errno 113] No route to host":
if not self.is_internet_up():
- self.error = "No valid internet connection found."
+ error = "No valid internet connection found."
else:
- self.error = "Provider server appears to be down."
+ error = "Provider server appears to be down."
+ raise eipexceptions.NoInternetConnection(error)
def is_internet_up(self):
iface, gateway = self.get_default_interface_gateway()