Fixed error handling in dhcpdump.py

This commit is contained in:
Ossi Salmi 2011-06-08 14:21:47 +03:00 committed by Timo Mkinen
parent 7da2da06e2
commit edbd519dc0

View file

@ -24,7 +24,7 @@ def main():
def ldapsearch(filter): def ldapsearch(filter):
p = Popen(['ldapsearch', '-x', '-LLL', filter, 'cn', 'macAddress', 'ipHostNumber'], p = Popen(['ldapsearch', '-x', '-z', '0', '-LLL', filter, 'cn', 'macAddress', 'ipHostNumber'],
bufsize=1024, stdout=PIPE, close_fds=True) bufsize=1024, stdout=PIPE, close_fds=True)
ret = [] ret = []
cur = {} cur = {}
@ -35,7 +35,7 @@ def ldapsearch(filter):
ret.append('host %s { option host-name "%s"; hardware ethernet %s; fixed-address %s; }' % ( ret.append('host %s { option host-name "%s"; hardware ethernet %s; fixed-address %s; }' % (
cur["cn"], cur["cn"].split('.')[0], cur["macAddress"], cur["ipHostNumber"])) cur["cn"], cur["cn"].split('.')[0], cur["macAddress"], cur["ipHostNumber"]))
except KeyError: except KeyError:
print "foo" print >>sys.stderr, "skipping: %s" % repr(cur)
cur = {} cur = {}
continue continue
l = l.split() l = l.split()