mirror of
https://github.com/docker/compose.git
synced 2025-07-24 06:04:57 +02:00
Fixes #1422: ipv6 addr contains colons, so we split only by the first char.
Signed-off-by: Clemens Gutweiler <cg@vioma.de>
This commit is contained in:
parent
ed87d1f848
commit
ce9f2681a2
@ -58,7 +58,7 @@ def parse_extra_hosts(extra_hosts_config):
|
|||||||
extra_hosts_dict = {}
|
extra_hosts_dict = {}
|
||||||
for extra_hosts_line in extra_hosts_config:
|
for extra_hosts_line in extra_hosts_config:
|
||||||
# TODO: validate string contains ':' ?
|
# TODO: validate string contains ':' ?
|
||||||
host, ip = extra_hosts_line.split(':')
|
host, ip = extra_hosts_line.split(':', 1)
|
||||||
extra_hosts_dict[host.strip()] = ip.strip()
|
extra_hosts_dict[host.strip()] = ip.strip()
|
||||||
return extra_hosts_dict
|
return extra_hosts_dict
|
||||||
|
|
||||||
|
@ -16,11 +16,13 @@ def test_parse_extra_hosts_list():
|
|||||||
assert parse_extra_hosts([
|
assert parse_extra_hosts([
|
||||||
"www.example.com: 192.168.0.17",
|
"www.example.com: 192.168.0.17",
|
||||||
"static.example.com:192.168.0.19",
|
"static.example.com:192.168.0.19",
|
||||||
"api.example.com: 192.168.0.18"
|
"api.example.com: 192.168.0.18",
|
||||||
|
"v6.example.com: ::1"
|
||||||
]) == {
|
]) == {
|
||||||
'www.example.com': '192.168.0.17',
|
'www.example.com': '192.168.0.17',
|
||||||
'static.example.com': '192.168.0.19',
|
'static.example.com': '192.168.0.19',
|
||||||
'api.example.com': '192.168.0.18'
|
'api.example.com': '192.168.0.18',
|
||||||
|
'v6.example.com': '::1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user