PEP8 the rest of the file
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Monitor Interfaces, send hb msg when add changes
|
||||
import time, os, sys
|
||||
import time
|
||||
import os
|
||||
|
||||
SLEEP = 60
|
||||
SRV = "colo2.wapanafa.org"
|
||||
@@ -15,13 +16,15 @@ f=os.popen('/sbin/ifconfig -a 2>/dev/null', 'r')
|
||||
for l in f.readlines():
|
||||
if len(l) > 1 and not l[0] in [' ', '\t']:
|
||||
r = l.split()
|
||||
if DBG: print r
|
||||
if DBG:
|
||||
print r
|
||||
if r[0][-1] == ':':
|
||||
r[0] = r[0][:-1]
|
||||
if r[0][:2] == 'lo':
|
||||
continue
|
||||
IFS.append(r[0])
|
||||
if DBG: print IFS
|
||||
if DBG:
|
||||
print IFS
|
||||
addrs = {}
|
||||
for I in IFS:
|
||||
addrs[I] = ""
|
||||
@@ -33,7 +36,8 @@ while 1:
|
||||
ifaddrs = []
|
||||
for l in f.readlines():
|
||||
r = l.split()
|
||||
if DBG > 1: print "x2", r
|
||||
if DBG > 1:
|
||||
print "x2", r
|
||||
if len(r) == 0 or (r[0] != 'inet' and r[0] != 'inet6'):
|
||||
continue
|
||||
if r[1].find('addr:') == 0:
|
||||
@@ -44,8 +48,10 @@ while 1:
|
||||
|
||||
if ifaddrs != [] and ifaddrs != addrs[I]:
|
||||
msg = '%s -m "ifadd %s %s" %s' % (HBC, I, ",".join(ifaddrs), SRV)
|
||||
if DBG: print msg
|
||||
else: os.system(msg)
|
||||
if DBG:
|
||||
print msg
|
||||
else:
|
||||
os.system(msg)
|
||||
addrs[I] = ifaddrs
|
||||
f.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user