@Override public SecurityStore generate(String hostname, String containerId, AggregateConf instanceDefinition, MapOperations compOps, String role) throws SliderException, IOException { SecurityStore truststore = null; String password = getStorePassword( instanceDefinition.getAppConf().credentials, compOps, role); if (password != null) { truststore = certificateMgr.generateContainerTruststore(containerId, role, password); } return truststore; }
private void actionDiagnosticApplication(ActionDiagnosticArgs diagnosticArgs) throws YarnException, IOException { // not using member variable clustername because we want to place // application name after --application option and member variable // cluster name has to be put behind action String clusterName = diagnosticArgs.name; requireArgumentSet(Arguments.ARG_NAME, clusterName); AggregateConf instanceDefinition = fetchInstanceDefinition(clusterName); String clusterDir = instanceDefinition.getAppConfOperations() .getGlobalOptions().get(AgentKeys.APP_ROOT); String pkgTarball = getApplicationDefinitionPath(instanceDefinition.getAppConfOperations()); String runAsUser = instanceDefinition.getAppConfOperations() .getGlobalOptions().get(AgentKeys.RUNAS_USER); log.info("The location of the cluster instance directory in HDFS is: {}", clusterDir); log.info("The name of the application package tarball on HDFS is: {}",pkgTarball); log.info("The runas user of the application in the cluster is: {}",runAsUser); if (diagnosticArgs.verbose) { log.info("App config of the application:\n{}", instanceDefinition.getAppConf().toJson()); log.info("Resource config of the application:\n{}", instanceDefinition.getResources().toJson()); } }
private void actionDiagnosticApplication(ActionDiagnosticArgs diagnosticArgs) throws YarnException, IOException { // not using member variable clustername because we want to place // application name after --application option and member variable // cluster name has to be put behind action String clusterName = diagnosticArgs.name; requireArgumentSet(Arguments.ARG_NAME, clusterName); AggregateConf instanceDefinition = fetchInstanceDefinition(clusterName); String clusterDir = instanceDefinition.getAppConfOperations() .getGlobalOptions().get(AgentKeys.APP_ROOT); String pkgTarball = getApplicationDefinitionPath(instanceDefinition.getAppConfOperations()); String runAsUser = instanceDefinition.getAppConfOperations() .getGlobalOptions().get(AgentKeys.RUNAS_USER); log.info("The location of the cluster instance directory in HDFS is: {}", clusterDir); log.info("The name of the application package tarball on HDFS is: {}",pkgTarball); log.info("The runas user of the application in the cluster is: {}",runAsUser); if (diagnosticArgs.verbose) { log.info("App config of the application:\n{}", instanceDefinition.getAppConf().toJson()); log.info("Resource config of the application:\n{}", instanceDefinition.getResources().toJson()); } }
@Override public SecurityStore generate(String hostname, String containerId, AggregateConf instanceDefinition, MapOperations compOps, String role) throws SliderException, IOException { SecurityStore truststore = null; String password = getStorePassword( instanceDefinition.getAppConf().credentials, compOps, role); if (password != null) { truststore = certificateMgr.generateContainerTruststore(containerId, role, password); } return truststore; }
@Override public SecurityStore generate(String hostname, String containerId, AggregateConf instanceDefinition, MapOperations compOps, String role) throws SliderException, IOException { SecurityStore keystore = null; String password = getStorePassword( instanceDefinition.getAppConf().credentials, compOps, role); if (password != null) { keystore = certificateMgr.generateContainerKeystore(hostname, containerId, role, password); } return keystore; }
@Override public SecurityStore generate(String hostname, String containerId, AggregateConf instanceDefinition, MapOperations compOps, String role) throws SliderException, IOException { SecurityStore keystore = null; String password = getStorePassword( instanceDefinition.getAppConf().credentials, compOps, role); if (password != null) { keystore = certificateMgr.generateContainerKeystore(hostname, containerId, role, password); } return keystore; }
public AggregateConfResource(AggregateConf conf, UriBuilder uriBuilder) { if (uriBuilder != null) { this.href = uriBuilder.build().toASCIIString(); resources = ResourceFactory.createConfTreeResource(conf.getResources(), uriBuilder.clone().path("configurations").path("resources")); internal = ResourceFactory.createConfTreeResource(conf.getInternal(), uriBuilder.clone().path("configurations").path("internal")); appConf = ResourceFactory.createConfTreeResource(conf.getAppConf(), uriBuilder.clone().path("configurations").path("appConf")); initConfMap(); } else { resources = null; internal = null; appConf = null; } }
public AggregateConfResource(AggregateConf conf, UriBuilder uriBuilder) { if (uriBuilder != null) { this.href = uriBuilder.build().toASCIIString(); resources = ResourceFactory.createConfTreeResource(conf.getResources(), uriBuilder.clone().path("configurations").path("resources")); internal = ResourceFactory.createConfTreeResource(conf.getInternal(), uriBuilder.clone().path("configurations").path("internal")); appConf = ResourceFactory.createConfTreeResource(conf.getAppConf(), uriBuilder.clone().path("configurations").path("appConf")); initConfMap(); } else { resources = null; internal = null; appConf = null; } }
@Override public ConfTree refresh() throws Exception { AggregateConf aggregateConf = unresolved ? state.getUnresolvedInstanceDefinition(): state.getInstanceDefinitionSnapshot(); ConfTree ct = resources ? aggregateConf.getResources() : aggregateConf.getAppConf(); return new ConfTreeSerDeser().fromInstance(ct); } }
private void saveConf(AggregateConf conf) throws IOException { confTreeSerDeser.save(fileSystem, internal, conf.getInternal(), true); confTreeSerDeser.save(fileSystem, resources, conf.getResources(), true); confTreeSerDeser.save(fileSystem, app_conf, conf.getAppConf(), true); }
private void saveConf(AggregateConf conf) throws IOException { confTreeSerDeser.save(fileSystem, internal, conf.getInternal(), true); confTreeSerDeser.save(fileSystem, resources, conf.getResources(), true); confTreeSerDeser.save(fileSystem, app_conf, conf.getAppConf(), true); }
@Override public ConfTree refresh() throws Exception { AggregateConf aggregateConf = unresolved ? state.getUnresolvedInstanceDefinition(): state.getInstanceDefinitionSnapshot(); ConfTree ct = resources ? aggregateConf.getResources() : aggregateConf.getAppConf(); return new ConfTreeSerDeser().fromInstance(ct); } }
@Test public void testContainerKeystoreGenerationViaStoresGeneratorOverrideGlobalSetting() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = setupComponentOptions(true, null, "app1.component1.password.property", null, null); instanceDefinition.getAppConf().components.put("component1", compOps); instanceDefinition.getAppConf().global.put( "app1.component1.password.property", "password"); instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "false"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
@Test public void testContainerKeystoreGenerationViaStoresGeneratorOverrideGlobalSetting() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = setupComponentOptions(true, null, "app1.component1.password.property", null, null); instanceDefinition.getAppConf().components.put("component1", compOps); instanceDefinition.getAppConf().global.put( "app1.component1.password.property", "password"); instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "false"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
/** * Take a snapshot of the configuration * @param instanceDefinition source * @throws IOException marshalling/copying problems */ public AggregateConf(AggregateConf instanceDefinition) throws IOException { ConfTreeOperations resourcesSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getResources()); ConfTreeOperations appConfSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getAppConf()); ConfTreeOperations internalsSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getInternal()); //build a new aggregate from the snapshots setResources(resourcesSnapshot.confTree); setAppConf(appConfSnapshot.confTree); setInternal(internalsSnapshot.confTree); }
/** * Take a snapshot of the configuration * @param instanceDefinition source * @throws IOException marshalling/copying problems */ public AggregateConf(AggregateConf instanceDefinition) throws IOException { ConfTreeOperations resourcesSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getResources()); ConfTreeOperations appConfSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getAppConf()); ConfTreeOperations internalsSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getInternal()); //build a new aggregate from the snapshots setResources(resourcesSnapshot.confTree); setAppConf(appConfSnapshot.confTree); setInternal(internalsSnapshot.confTree); }
@Test public void testContainerKeystoreGenerationViaStoresGenerator() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = new MapOperations(); instanceDefinition.getAppConf().components.put("component1", compOps); compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY, "app1.component1.password.property"); compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true"); instanceDefinition.getAppConf().global.put( "app1.component1.password.property", "password"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
@Test public void testContainerKeystoreGenerationViaStoresGenerator() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = new MapOperations(); instanceDefinition.getAppConf().components.put("component1", compOps); compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY, "app1.component1.password.property"); compOps.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true"); instanceDefinition.getAppConf().global.put( "app1.component1.password.property", "password"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
@Test public void testContainerKeystoreGenerationViaStoresGeneratorUsingGlobalProps() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = new MapOperations(); instanceDefinition.getAppConf().components.put("component1", compOps); compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY, "app1.component1.password.property"); instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true"); compOps.put( "app1.component1.password.property", "password"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }
@Test public void testContainerKeystoreGenerationViaStoresGeneratorUsingGlobalProps() throws Exception { AggregateConf instanceDefinition = new AggregateConf(); MapOperations compOps = new MapOperations(); instanceDefinition.getAppConf().components.put("component1", compOps); compOps.put(SliderKeys.COMP_KEYSTORE_PASSWORD_PROPERTY_KEY, "app1.component1.password.property"); instanceDefinition.getAppConf().global.put(SliderKeys.COMP_STORES_REQUIRED_KEY, "true"); compOps.put( "app1.component1.password.property", "password"); instanceDefinition.resolve(); SecurityStore[] files = StoresGenerator.generateSecurityStores("testhost", "container1", "component1", instanceDefinition, compOps); assertEquals("wrong number of stores", 1, files.length); validateKeystore(files[0].getFile(), "testhost", "cahost"); }