Fixed error handling in dhcpdump.py
This commit is contained in:
parent
7da2da06e2
commit
edbd519dc0
1 changed files with 2 additions and 2 deletions
|
@ -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()
|
||||||
|
|
Loading…
Add table
Reference in a new issue