diff options
| author | Jeff Lane <jeffrey.lane@canonical.com> | 2014-10-08 15:34:46 -0400 |
|---|---|---|
| committer | Jeff Lane <jeffrey.lane@canonical.com> | 2014-10-08 15:34:46 -0400 |
| commit | 875441a06afefb872fecc40ca4448363eef4fa91 (patch) | |
| tree | b4f8f9934ab4e7926039a4b3b09f0faa0b82ff3e /bin | |
| parent | 36d7574af0bf454a280366647315fb1d0859571e (diff) | |
PEP8 fixes for network_info script
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/network_info | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/network_info b/bin/network_info index b9b46dd..9c20b89 100755 --- a/bin/network_info +++ b/bin/network_info @@ -38,9 +38,10 @@ def get_ip_address(interface): struct.pack('256s', interface[:15].encode()) )[20:24]) + def get_ipv6_address(interface): cmd = ['/sbin/ip', '-6', 'addr', 'show', 'dev', interface] - proc = subprocess.check_output(cmd,universal_newlines=True) + proc = subprocess.check_output(cmd, universal_newlines=True) ipaddr = proc.split()[8].strip() return ipaddr @@ -63,14 +64,14 @@ def main(args): print("Interface: %s" % interface) print("Connected: %s" % connected) try: - print("IPv4: %s" % get_ip_address(interface)) + print("IPv4: %s" % get_ip_address(interface)) except IOError: print("IPv4: n/a") - try: - print("IPv6: %s" % get_ipv6_address(interface)) + try: + print("IPv6: %s" % get_ipv6_address(interface)) except IOError: print("IPv6: n/a") - except: + except: print("IPv6: n/a") print("MAC: %s\n" % get_mac_address(interface)) |
