Fix dns and dns_search when used strings and without extends.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2015-12-09 16:32:39 -08:00
parent 6fe747e0ee
commit fa3528ea25
2 changed files with 23 additions and 2 deletions

View File

@ -387,6 +387,10 @@ def process_service(service_config):
if 'extra_hosts' in service_dict:
service_dict['extra_hosts'] = parse_extra_hosts(service_dict['extra_hosts'])
for field in ['dns', 'dns_search']:
if field in service_dict:
service_dict[field] = to_list(service_dict[field])
# TODO: move to a validate_service()
if 'ulimits' in service_dict:
validate_ulimits(service_dict['ulimits'])

View File

@ -535,6 +535,23 @@ class ConfigTest(unittest.TestCase):
}))
assert "which is an invalid type" in exc.exconly()
def test_normalize_dns_options(self):
actual = config.load(build_config_details({
'web': {
'image': 'alpine',
'dns': '8.8.8.8',
'dns_search': 'domain.local',
}
}))
assert actual == [
{
'name': 'web',
'image': 'alpine',
'dns': ['8.8.8.8'],
'dns_search': ['domain.local'],
}
]
class PortsTest(unittest.TestCase):
INVALID_PORTS_TYPES = [
@ -1080,8 +1097,8 @@ class EnvTest(unittest.TestCase):
{'foo': {'image': 'example', 'env_file': 'nonexistent.env'}},
working_dir='tests/fixtures/env'))
assert 'Couldn\'t find env file' in exc.exconly()
assert 'nonexistent.env' in exc.exconly()
assert 'Couldn\'t find env file' in exc.exconly()
assert 'nonexistent.env' in exc.exconly()
@mock.patch.dict(os.environ)
def test_resolve_environment_from_env_file_with_empty_values(self):