Avoid KeyError exception
Change-Id: I7c25cf3c9d4da1d13a3b9c3e8a47d381883ca256
This commit is contained in:
parent
34e4e3431f
commit
3940e9eb4a
|
@ -114,7 +114,7 @@ class FIPSetEvent(base_watcher.PortBindingChassisEvent):
|
|||
ips = nat.split(" ")[1:-1]
|
||||
port = nat.split(" ")[-1].split("\"")[1]
|
||||
ips_to_expose = [ip for ip in ips
|
||||
if ip not in old_cr_lrps[port]]
|
||||
if ip not in old_cr_lrps.get(port, set())]
|
||||
self.agent.expose_ip(ips_to_expose, row, associated_port=port)
|
||||
|
||||
|
||||
|
@ -150,7 +150,8 @@ class FIPUnsetEvent(base_watcher.PortBindingChassisEvent):
|
|||
ips = nat.split(" ")[1:-1]
|
||||
port = nat.split(" ")[-1].split("\"")[1]
|
||||
ips_to_withdraw = [ip for ip in ips
|
||||
if ip not in current_cr_lrps[port]]
|
||||
if ip not in current_cr_lrps.get(port,
|
||||
set())]
|
||||
self.agent.withdraw_ip(ips_to_withdraw, row,
|
||||
associated_port=port)
|
||||
|
||||
|
|
Loading…
Reference in New Issue