Add whitelisted driver option added by the overlay driver to avoid breakage

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2016-11-01 11:09:29 -07:00
commit ba43d08fbd
2 changed files with 68 additions and 0 deletions

View file

@ -12,6 +12,10 @@ from .config import ConfigurationError
log = logging.getLogger(__name__)
OPTS_EXCEPTIONS = [
'com.docker.network.driver.overlay.vxlanid_list',
]
class Network(object):
def __init__(self, client, project, name, driver=None, driver_opts=None,
@ -113,6 +117,23 @@ def create_ipam_config_from_dict(ipam_dict):
)
def check_remote_network_config(remote, local):
if local.driver and remote['Driver'] != local.driver:
raise ConfigurationError(
'Network "{}" needs to be recreated - driver has changed'
.format(local.full_name)
)
local_opts = local.driver_opts or {}
for k in set.union(set(remote['Options'].keys()), set(local_opts.keys())):
if k in OPTS_EXCEPTIONS:
continue
if remote['Options'].get(k) != local_opts.get(k):
raise ConfigurationError(
'Network "{}" needs to be recreated - options have changed'
.format(local.full_name)
)
def build_networks(name, config_data, client):
network_config = config_data.networks or {}
networks = {