use set to add them once

This commit is contained in:
alsadi 2019-03-05 00:46:42 +02:00
parent 1ad8c19e85
commit ed09b46f83

View File

@ -87,13 +87,13 @@ def move_list(dst, containers, key):
"""
move key (like port forwarding) from containers to dst (a pod or a infra container)
"""
a=dst.get(key) or []
a=set(dst.get(key) or [])
for cnt in containers:
a0 = cnt.get(key)
if a0:
a.extend(a0)
a.update(a0)
del cnt[key]
if a: dst[key]=a
if a: dst[key]=list(a)
def move_port_fw(dst, containers):
"""