فهرست منبع

Merge pull request #2617 from gutweiler/extra-hosts-ipv6

Extra hosts ipv6
Joffrey F 9 سال پیش
والد
کامیت
796d97e394
2فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 1 1
      compose/config/types.py
  2. 4 2
      tests/unit/config/types_test.py

+ 1 - 1
compose/config/types.py

@@ -96,7 +96,7 @@ def parse_extra_hosts(extra_hosts_config):
         extra_hosts_dict = {}
         for extra_hosts_line in extra_hosts_config:
             # TODO: validate string contains ':' ?
-            host, ip = extra_hosts_line.split(':')
+            host, ip = extra_hosts_line.split(':', 1)
             extra_hosts_dict[host.strip()] = ip.strip()
         return extra_hosts_dict
 

+ 4 - 2
tests/unit/config/types_test.py

@@ -22,11 +22,13 @@ def test_parse_extra_hosts_list():
     assert parse_extra_hosts([
         "www.example.com: 192.168.0.17",
         "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',
         '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'
     }