Improve merging for several service config attributes

All uniqueItems lists in the config now receive the same treatment removing
duplicates.

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2016-05-19 15:42:37 -07:00
parent 842e372258
commit c4229b469a
1 changed files with 5 additions and 9 deletions

View File

@ -4,7 +4,6 @@ from __future__ import unicode_literals
import functools
import logging
import ntpath
import operator
import os
import string
import sys
@ -744,18 +743,15 @@ def merge_service_dicts(base, override, version):
md.merge_mapping('ulimits', parse_ulimits)
md.merge_mapping('networks', parse_networks)
md.merge_sequence('links', ServiceLink.parse)
md.merge_field('ports', merge_port_mappings, default=[])
for field in ['volumes', 'devices']:
md.merge_field(field, merge_path_mappings)
for field in [
'depends_on',
'expose',
'external_links',
'volumes_from',
'ports', 'cap_add', 'cap_drop', 'expose', 'external_links',
'security_opt', 'volumes_from', 'depends_on',
]:
md.merge_field(field, operator.add, default=[])
md.merge_field(field, merge_unique_items_lists, default=[])
for field in ['dns', 'dns_search', 'env_file', 'tmpfs']:
md.merge_field(field, merge_list_or_string)
@ -771,8 +767,8 @@ def merge_service_dicts(base, override, version):
return dict(md)
def merge_port_mappings(base, override):
return list(set().union(base, override))
def merge_unique_items_lists(base, override):
return sorted(set().union(base, override))
def merge_build(output, base, override):