Update existing container_networks

We don't update an existing container_network so once you have settings
set, they will not be changed, even if you change settings.

This patch ensures that if the existing container_network does not match
the current provider_network, it will get updated.

Closes-Bug: 1678165
Change-Id: Ia6d91bd6aabf0f9584a83641d5bd990d3f9e404f
This commit is contained in:
Andy McCrae 2017-08-17 13:20:31 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 7b3aac28a0
commit 850d8f2663
1 changed files with 11 additions and 15 deletions

View File

@ -615,16 +615,18 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface,
if properties:
is_metal = properties.get('is_metal', False)
_network = network_entry(
is_metal,
interface,
bridge,
net_type,
net_mtu
)
# This should convert found addresses based on q_name + "_address"
# and then build the network if its not found.
if not is_metal and old_address not in networks:
network = networks[old_address] = network_entry(
is_metal,
interface,
bridge,
net_type,
net_mtu
)
if not is_metal and (old_address not in networks or
networks[old_address] != _network):
network = networks[old_address] = _network
if old_address in container and container[old_address]:
network['address'] = container.pop(old_address)
elif not is_metal:
@ -634,13 +636,7 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface,
network['netmask'] = netmask
elif is_metal:
network = networks[old_address] = network_entry(
is_metal,
interface,
bridge,
net_type,
net_mtu
)
network = networks[old_address] = _network
network['netmask'] = netmask
if is_ssh_address or is_container_address:
# Container physical host group