/** * Configures an artifact server to serve the artifacts associated with a container specification. * @param server the server to configure. * @param container the container with artifacts to serve. * @throws IOException if the artifacts cannot be accessed. */ static void configureArtifactServer(MesosArtifactServer server, ContainerSpecification container) throws IOException { // serve the artifacts associated with the container environment for (ContainerSpecification.Artifact artifact : container.getArtifacts()) { server.addPath(artifact.source, artifact.dest); } } }
for (ContainerSpecification.Artifact artifact : containerSpec.getArtifacts()) { cmd.addUris(Utils.uri(resolver, artifact));
@Override public FileVisitResult visitFile(java.nio.file.Path file, BasicFileAttributes attrs) throws IOException { java.nio.file.Path relativePath = sourceRoot.relativize(file); ContainerSpecification.Artifact.Builder artifact = ContainerSpecification.Artifact.newBuilder() .setSource(new Path(file.toUri())) .setDest(new Path(targetPath, relativePath.toString())) .setExecutable(Files.isExecutable(file)) .setCachable(true) .setExtract(false); env.getArtifacts().add(artifact.build()); return super.visitFile(file, attrs); } });
@Override public FileVisitResult visitFile(java.nio.file.Path file, BasicFileAttributes attrs) throws IOException { java.nio.file.Path relativePath = sourceRoot.relativize(file); ContainerSpecification.Artifact.Builder artifact = ContainerSpecification.Artifact.newBuilder() .setSource(new Path(file.toUri())) .setDest(new Path(targetPath, relativePath.toString())) .setExecutable(Files.isExecutable(file)) .setCachable(true) .setExtract(false); env.getArtifacts().add(artifact.build()); return super.visitFile(file, attrs); } });
@Override public FileVisitResult visitFile(java.nio.file.Path file, BasicFileAttributes attrs) throws IOException { java.nio.file.Path relativePath = sourceRoot.relativize(file); ContainerSpecification.Artifact.Builder artifact = ContainerSpecification.Artifact.newBuilder() .setSource(new Path(file.toUri())) .setDest(new Path(targetPath, relativePath.toString())) .setExecutable(Files.isExecutable(file)) .setCachable(true) .setExtract(false); env.getArtifacts().add(artifact.build()); return super.visitFile(file, attrs); } });
@Override public FileVisitResult visitFile(java.nio.file.Path file, BasicFileAttributes attrs) throws IOException { java.nio.file.Path relativePath = sourceRoot.relativize(file); ContainerSpecification.Artifact.Builder artifact = ContainerSpecification.Artifact.newBuilder() .setSource(new Path(file.toUri())) .setDest(new Path(targetPath, relativePath.toString())) .setExecutable(Files.isExecutable(file)) .setCachable(true) .setExtract(false); env.getArtifacts().add(artifact.build()); return super.visitFile(file, attrs); } });
@Override public void configure(ContainerSpecification container) throws IOException { if(hadoopConfDir == null) { return; } File coreSitePath = new File(hadoopConfDir, "core-site.xml"); File hdfsSitePath = new File(hadoopConfDir, "hdfs-site.xml"); container.getEnvironmentVariables().put("HADOOP_CONF_DIR", TARGET_CONF_DIR.toString()); container.getDynamicConfiguration().setString(ConfigConstants.PATH_HADOOP_CONFIG, TARGET_CONF_DIR.toString()); container.getArtifacts().add(ContainerSpecification.Artifact .newBuilder() .setSource(new Path(coreSitePath.toURI())) .setDest(new Path(TARGET_CONF_DIR, coreSitePath.getName())) .setCachable(true) .build()); container.getArtifacts().add(ContainerSpecification.Artifact .newBuilder() .setSource(new Path(hdfsSitePath.toURI())) .setDest(new Path(TARGET_CONF_DIR, hdfsSitePath.getName())) .setCachable(true) .build()); }
@Override public void configure(ContainerSpecification container) throws IOException { if(hadoopConfDir == null) { return; } File coreSitePath = new File(hadoopConfDir, "core-site.xml"); File hdfsSitePath = new File(hadoopConfDir, "hdfs-site.xml"); container.getEnvironmentVariables().put("HADOOP_CONF_DIR", TARGET_CONF_DIR.toString()); container.getDynamicConfiguration().setString(ConfigConstants.PATH_HADOOP_CONFIG, TARGET_CONF_DIR.toString()); container.getArtifacts().add(ContainerSpecification.Artifact .newBuilder() .setSource(new Path(coreSitePath.toURI())) .setDest(new Path(TARGET_CONF_DIR, coreSitePath.getName())) .setCachable(true) .build()); container.getArtifacts().add(ContainerSpecification.Artifact .newBuilder() .setSource(new Path(hdfsSitePath.toURI())) .setDest(new Path(TARGET_CONF_DIR, hdfsSitePath.getName())) .setCachable(true) .build()); }
@Override public void configure(ContainerSpecification container) throws IOException { if(krb5Conf != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(krb5Conf) .setDest(TARGET_PATH) .setCachable(true) .build()); container.getSystemProperties().setString(JAVA_SECURITY_KRB5_CONF, TARGET_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(keytab != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(keytab) .setDest(TARGET_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, TARGET_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(krb5Conf != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(krb5Conf) .setDest(TARGET_PATH) .setCachable(true) .build()); container.getSystemProperties().setString(JAVA_SECURITY_KRB5_CONF, TARGET_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(keytab != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(keytab) .setDest(TARGET_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, TARGET_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(krb5Conf != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(krb5Conf) .setDest(TARGET_PATH) .setCachable(true) .build()); container.getSystemProperties().setString(JAVA_SECURITY_KRB5_CONF, TARGET_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(keytab != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(keytab) .setDest(TARGET_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, TARGET_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(keytab != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(keytab) .setDest(TARGET_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, TARGET_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(krb5Conf != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(krb5Conf) .setDest(TARGET_PATH) .setCachable(true) .build()); container.getSystemProperties().setString(JAVA_SECURITY_KRB5_CONF, TARGET_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(keystore != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(keystore) .setDest(TARGET_KEYSTORE_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.SSL_KEYSTORE, TARGET_KEYSTORE_PATH.getPath()); } if(truststore != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(truststore) .setDest(TARGET_TRUSTSTORE_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.SSL_TRUSTSTORE, TARGET_TRUSTSTORE_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(keystore != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(keystore) .setDest(TARGET_KEYSTORE_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.SSL_KEYSTORE, TARGET_KEYSTORE_PATH.getPath()); } if(truststore != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(truststore) .setDest(TARGET_TRUSTSTORE_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.SSL_TRUSTSTORE, TARGET_TRUSTSTORE_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(keystore != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(keystore) .setDest(TARGET_KEYSTORE_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.SSL_KEYSTORE, TARGET_KEYSTORE_PATH.getPath()); } if(truststore != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(truststore) .setDest(TARGET_TRUSTSTORE_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.SSL_TRUSTSTORE, TARGET_TRUSTSTORE_PATH.getPath()); } }
@Override public void configure(ContainerSpecification container) throws IOException { if(keystore != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(keystore) .setDest(TARGET_KEYSTORE_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(ConfigConstants.SECURITY_SSL_KEYSTORE, TARGET_KEYSTORE_PATH.getPath()); } if(truststore != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(truststore) .setDest(TARGET_TRUSTSTORE_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(ConfigConstants.SECURITY_SSL_TRUSTSTORE, TARGET_TRUSTSTORE_PATH.getPath()); } }