diff options
author | Filipp Lepalaan <filipp@mac.com> | 2016-10-27 12:24:07 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2016-10-27 12:24:07 +0300 |
commit | d5107fb63a688236c4bd8275cb3884c2a58ec2f6 (patch) | |
tree | 53581fe57e6a5a132ad79ce64cd58ab5677c9dd4 | |
parent | b45a90055e8c2365ce305534d8475b04c8d0364c (diff) | |
download | machammer-d5107fb63a688236c4bd8275cb3884c2a58ec2f6.tar.gz machammer-d5107fb63a688236c4bd8275cb3884c2a58ec2f6.tar.bz2 machammer-d5107fb63a688236c4bd8275cb3884c2a58ec2f6.zip |
Raise custom exception with ifconfig
-rw-r--r-- | machammer/network.py | 6 |
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 |