@@ -640,6 +640,7 @@ def _get_container_host_config(self, override_options, one_off=False):
640
640
pid = options .get ('pid' , None )
641
641
security_opt = options .get ('security_opt' , None )
642
642
643
+ # TODO: these options are already normalized by config
643
644
dns = options .get ('dns' , None )
644
645
if isinstance (dns , six .string_types ):
645
646
dns = [dns ]
@@ -648,9 +649,6 @@ def _get_container_host_config(self, override_options, one_off=False):
648
649
if isinstance (dns_search , six .string_types ):
649
650
dns_search = [dns_search ]
650
651
651
- extra_hosts = build_extra_hosts (options .get ('extra_hosts' , None ))
652
- read_only = options .get ('read_only' , None )
653
-
654
652
devices = options .get ('devices' , None )
655
653
cgroup_parent = options .get ('cgroup_parent' , None )
656
654
ulimits = build_ulimits (options .get ('ulimits' , None ))
@@ -672,8 +670,8 @@ def _get_container_host_config(self, override_options, one_off=False):
672
670
memswap_limit = options .get ('memswap_limit' ),
673
671
ulimits = ulimits ,
674
672
log_config = log_config ,
675
- extra_hosts = extra_hosts ,
676
- read_only = read_only ,
673
+ extra_hosts = options . get ( ' extra_hosts' ) ,
674
+ read_only = options . get ( ' read_only' ) ,
677
675
pid_mode = pid ,
678
676
security_opt = security_opt ,
679
677
ipc_mode = options .get ('ipc' ),
@@ -1057,31 +1055,3 @@ def build_ulimits(ulimit_config):
1057
1055
ulimits .append (ulimit_dict )
1058
1056
1059
1057
return ulimits
1060
-
1061
-
1062
- # Extra hosts
1063
-
1064
-
1065
- def build_extra_hosts (extra_hosts_config ):
1066
- if not extra_hosts_config :
1067
- return {}
1068
-
1069
- if isinstance (extra_hosts_config , list ):
1070
- extra_hosts_dict = {}
1071
- for extra_hosts_line in extra_hosts_config :
1072
- if not isinstance (extra_hosts_line , six .string_types ):
1073
- raise ConfigError (
1074
- "extra_hosts_config \" %s\" must be either a list of strings or a string->string mapping," %
1075
- extra_hosts_config
1076
- )
1077
- host , ip = extra_hosts_line .split (':' )
1078
- extra_hosts_dict .update ({host .strip (): ip .strip ()})
1079
- extra_hosts_config = extra_hosts_dict
1080
-
1081
- if isinstance (extra_hosts_config , dict ):
1082
- return extra_hosts_config
1083
-
1084
- raise ConfigError (
1085
- "extra_hosts_config \" %s\" must be either a list of strings or a string->string mapping," %
1086
- extra_hosts_config
1087
- )
0 commit comments