@@ -655,6 +655,7 @@ def _get_container_host_config(self, override_options, one_off=False):
655
655
pid = options .get ('pid' , None )
656
656
security_opt = options .get ('security_opt' , None )
657
657
658
+ # TODO: these options are already normalized by config
658
659
dns = options .get ('dns' , None )
659
660
if isinstance (dns , six .string_types ):
660
661
dns = [dns ]
@@ -663,9 +664,6 @@ def _get_container_host_config(self, override_options, one_off=False):
663
664
if isinstance (dns_search , six .string_types ):
664
665
dns_search = [dns_search ]
665
666
666
- extra_hosts = build_extra_hosts (options .get ('extra_hosts' , None ))
667
- read_only = options .get ('read_only' , None )
668
-
669
667
devices = options .get ('devices' , None )
670
668
cgroup_parent = options .get ('cgroup_parent' , None )
671
669
ulimits = build_ulimits (options .get ('ulimits' , None ))
@@ -687,8 +685,8 @@ def _get_container_host_config(self, override_options, one_off=False):
687
685
memswap_limit = options .get ('memswap_limit' ),
688
686
ulimits = ulimits ,
689
687
log_config = log_config ,
690
- extra_hosts = extra_hosts ,
691
- read_only = read_only ,
688
+ extra_hosts = options . get ( ' extra_hosts' ) ,
689
+ read_only = options . get ( ' read_only' ) ,
692
690
pid_mode = pid ,
693
691
security_opt = security_opt ,
694
692
ipc_mode = options .get ('ipc' ),
@@ -1069,31 +1067,3 @@ def build_ulimits(ulimit_config):
1069
1067
ulimits .append (ulimit_dict )
1070
1068
1071
1069
return ulimits
1072
-
1073
-
1074
- # Extra hosts
1075
-
1076
-
1077
- def build_extra_hosts (extra_hosts_config ):
1078
- if not extra_hosts_config :
1079
- return {}
1080
-
1081
- if isinstance (extra_hosts_config , list ):
1082
- extra_hosts_dict = {}
1083
- for extra_hosts_line in extra_hosts_config :
1084
- if not isinstance (extra_hosts_line , six .string_types ):
1085
- raise ConfigError (
1086
- "extra_hosts_config \" %s\" must be either a list of strings or a string->string mapping," %
1087
- extra_hosts_config
1088
- )
1089
- host , ip = extra_hosts_line .split (':' )
1090
- extra_hosts_dict .update ({host .strip (): ip .strip ()})
1091
- extra_hosts_config = extra_hosts_dict
1092
-
1093
- if isinstance (extra_hosts_config , dict ):
1094
- return extra_hosts_config
1095
-
1096
- raise ConfigError (
1097
- "extra_hosts_config \" %s\" must be either a list of strings or a string->string mapping," %
1098
- extra_hosts_config
1099
- )
0 commit comments