Commit 9e33d518 authored by Xavier Thompson's avatar Xavier Thompson

slapformat: WIP: fix checkAddress

parent cedc1659
......@@ -382,20 +382,20 @@ class Interface(object):
interface = interface or getattr(self, 'ipv%d_interface' % ip.version)
flag = str(-ip.version)
_, result = call(['ip', flag, 'addr', 'show', interface])
address = str(ip.ip)
cidr = str(ip)
for line in result.splitlines():
if address in line:
if cidr in line:
for state in ('tentative', 'dadfailed'):
if state in line:
call(['ip', 'addr', 'del', address, 'dev', interface])
call(['ip', 'addr', 'del', cidr, 'dev', interface])
self.conf.abort(
"Address %s (%s) on %s was in state %s so was removed: %r",
ip, reason, interface, state, line
cidr, reason, interface, state, line
)
return
self.conf.abort(
"Address %s (%s) is unexpectedly not present on %s",
ip, reason, interface
cidr, reason, interface
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment