YARN-5793. Trim configuration values in DockerLinuxContainerRuntime (Contributed by Tianyin Xu via Daniel Templeton)

This commit is contained in:
Daniel Templeton 2016-10-31 13:51:07 -07:00
parent 2528bea67f
commit f3eb4c3c73
1 changed files with 8 additions and 6 deletions

View File

@ -219,9 +219,10 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime {
dockerClient = new DockerClient(conf); dockerClient = new DockerClient(conf);
allowedNetworks.clear(); allowedNetworks.clear();
allowedNetworks.addAll(Arrays.asList( allowedNetworks.addAll(Arrays.asList(
conf.getStrings(YarnConfiguration.NM_DOCKER_ALLOWED_CONTAINER_NETWORKS, conf.getTrimmedStrings(
YarnConfiguration.NM_DOCKER_ALLOWED_CONTAINER_NETWORKS,
YarnConfiguration.DEFAULT_NM_DOCKER_ALLOWED_CONTAINER_NETWORKS))); YarnConfiguration.DEFAULT_NM_DOCKER_ALLOWED_CONTAINER_NETWORKS)));
defaultNetwork = conf.get( defaultNetwork = conf.getTrimmed(
YarnConfiguration.NM_DOCKER_DEFAULT_CONTAINER_NETWORK, YarnConfiguration.NM_DOCKER_DEFAULT_CONTAINER_NETWORK,
YarnConfiguration.DEFAULT_NM_DOCKER_DEFAULT_CONTAINER_NETWORK); YarnConfiguration.DEFAULT_NM_DOCKER_DEFAULT_CONTAINER_NETWORK);
@ -237,7 +238,7 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime {
throw new ContainerExecutionException(message); throw new ContainerExecutionException(message);
} }
privilegedContainersAcl = new AccessControlList(conf.get( privilegedContainersAcl = new AccessControlList(conf.getTrimmed(
YarnConfiguration.NM_DOCKER_PRIVILEGED_CONTAINERS_ACL, YarnConfiguration.NM_DOCKER_PRIVILEGED_CONTAINERS_ACL,
YarnConfiguration.DEFAULT_NM_DOCKER_PRIVILEGED_CONTAINERS_ACL)); YarnConfiguration.DEFAULT_NM_DOCKER_PRIVILEGED_CONTAINERS_ACL));
} }
@ -439,9 +440,10 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime {
LOCALIZED_RESOURCES); LOCALIZED_RESOURCES);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<String> userLocalDirs = ctx.getExecutionAttribute(USER_LOCAL_DIRS); List<String> userLocalDirs = ctx.getExecutionAttribute(USER_LOCAL_DIRS);
Set<String> capabilities = new HashSet<>(Arrays.asList(conf.getStrings( Set<String> capabilities = new HashSet<>(Arrays.asList(
YarnConfiguration.NM_DOCKER_CONTAINER_CAPABILITIES, conf.getTrimmedStrings(
YarnConfiguration.DEFAULT_NM_DOCKER_CONTAINER_CAPABILITIES))); YarnConfiguration.NM_DOCKER_CONTAINER_CAPABILITIES,
YarnConfiguration.DEFAULT_NM_DOCKER_CONTAINER_CAPABILITIES)));
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
DockerRunCommand runCommand = new DockerRunCommand(containerIdStr, DockerRunCommand runCommand = new DockerRunCommand(containerIdStr,