aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-10-27 12:24:07 +0300
committerFilipp Lepalaan <filipp@mac.com>2016-10-27 12:24:07 +0300
commitd5107fb63a688236c4bd8275cb3884c2a58ec2f6 (patch)
tree53581fe57e6a5a132ad79ce64cd58ab5677c9dd4
parentb45a90055e8c2365ce305534d8475b04c8d0364c (diff)
downloadmachammer-d5107fb63a688236c4bd8275cb3884c2a58ec2f6.tar.gz
machammer-d5107fb63a688236c4bd8275cb3884c2a58ec2f6.tar.bz2
machammer-d5107fb63a688236c4bd8275cb3884c2a58ec2f6.zip
Raise custom exception with ifconfig
-rw-r--r--machammer/network.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/machammer/network.py b/machammer/network.py
index 17608ce..5f5fb87 100644
--- a/machammer/network.py
+++ b/machammer/network.py
@@ -32,7 +32,11 @@ def get_wifi_power():
def is_wired(primary=False):
"""Do we have an "active" Ethernet connection?"""
for p in get_ports('Ethernet'):
- r = check_output('/sbin/ifconfig', p['interface'])
+ try:
+ r = check_output('/sbin/ifconfig', p['interface'])
+ except Exception as e:
+ raise Exception('Failed to get interface status: %s' % e)
+
active = 'status: active' in r
return get_primary(p['interface']) if primary else active