private void addCustomMasterBootstrapActionConfig(EmrClusterDefinition emrClusterDefinition, ArrayList<BootstrapActionConfig> bootstrapActions) { // Add Master custom bootstrap script support if needed if (!CollectionUtils.isEmpty(emrClusterDefinition.getCustomBootstrapActionMaster())) { for (ScriptDefinition scriptDefinition : emrClusterDefinition.getCustomBootstrapActionMaster()) { BootstrapActionConfig bootstrapActionConfig = getBootstrapActionConfig(scriptDefinition.getScriptName(), configurationHelper.getProperty(ConfigurationValue.EMR_CONDITIONAL_SCRIPT)); // Add arguments to the bootstrap script ArrayList<String> argList = new ArrayList<>(); // Execute this script only on the master node. argList.add(configurationHelper.getProperty(ConfigurationValue.EMR_NODE_CONDITION)); argList.add(scriptDefinition.getScriptLocation()); if (!CollectionUtils.isEmpty(scriptDefinition.getScriptArguments())) { for (String argument : scriptDefinition.getScriptArguments()) { // Trim the argument argList.add(argument.trim()); } } bootstrapActionConfig.getScriptBootstrapAction().setArgs(argList); bootstrapActions.add(bootstrapActionConfig); } } }
private void addCustomMasterBootstrapActionConfig(EmrClusterDefinition emrClusterDefinition, ArrayList<BootstrapActionConfig> bootstrapActions) { // Add Master custom bootstrap script support if needed if (!CollectionUtils.isEmpty(emrClusterDefinition.getCustomBootstrapActionMaster())) { for (ScriptDefinition scriptDefinition : emrClusterDefinition.getCustomBootstrapActionMaster()) { BootstrapActionConfig bootstrapActionConfig = getBootstrapActionConfig(scriptDefinition.getScriptName(), configurationHelper.getProperty(ConfigurationValue.EMR_CONDITIONAL_SCRIPT)); // Add arguments to the bootstrap script ArrayList<String> argList = new ArrayList<>(); // Execute this script only on the master node. argList.add(configurationHelper.getProperty(ConfigurationValue.EMR_NODE_CONDITION)); argList.add(scriptDefinition.getScriptLocation()); if (!CollectionUtils.isEmpty(scriptDefinition.getScriptArguments())) { for (String argument : scriptDefinition.getScriptArguments()) { // Trim the argument argList.add(argument.trim()); } } bootstrapActionConfig.getScriptBootstrapAction().setArgs(argList); bootstrapActions.add(bootstrapActionConfig); } } }
emrClusterDefinition.getCustomBootstrapActionAll().add(secondAllScript); ScriptDefinition masterScript = emrClusterDefinition.getCustomBootstrapActionMaster().get(0); ScriptDefinition secondMasterScript = new ScriptDefinition(); secondMasterScript.setScriptName(masterScript.getScriptName() + "_second"); secondMasterScript.setScriptLocation(masterScript.getScriptLocation()); secondMasterScript.setScriptArguments(masterScript.getScriptArguments()); emrClusterDefinition.getCustomBootstrapActionMaster().add(secondMasterScript);
/** * This method tests the blank values for various parameters */ @Test public void testCreateEmrClusterBlankParams() throws Exception { // Create the namespace entity. NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE); String configXml = IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream()); EmrClusterDefinition emrClusterDefinition = xmlHelper.unmarshallXmlToObject(EmrClusterDefinition.class, configXml); List<ScriptDefinition> scriptDefinitions = emrClusterDefinition.getCustomBootstrapActionAll(); scriptDefinitions.get(0).setScriptArguments(null); emrClusterDefinition.setCustomBootstrapActionAll(scriptDefinitions); scriptDefinitions = emrClusterDefinition.getCustomBootstrapActionMaster(); scriptDefinitions.get(0).setScriptArguments(null); emrClusterDefinition.setCustomBootstrapActionMaster(scriptDefinitions); emrClusterDefinition.setVisibleToAll(null); emrClusterDefinition.setServiceIamRole(null); emrClusterDefinition.setAmiVersion(null); emrClusterDefinition.setServiceIamRole(emrClusterDefinition.getEc2NodeIamProfileName()); emrClusterDefinition.setScaleDownBehavior(null); emrClusterDefinition.setKerberosAttributes(null); configXml = xmlHelper.objectToXml(emrClusterDefinition); emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME, configXml); // Create a new EMR cluster create request EmrClusterCreateRequest request = getNewEmrClusterCreateRequest(); emrService.createCluster(request); }
expectedEmrClusterDefinition.setCustomBootstrapActionAll(emrClusterDefinitionOverride.getCustomBootstrapActionAll()); emrClusterDefinitionOverride.setCustomBootstrapActionMaster(Collections.<ScriptDefinition>emptyList()); expectedEmrClusterDefinition.setCustomBootstrapActionMaster(emrClusterDefinitionOverride.getCustomBootstrapActionMaster()); emrClusterDefinitionOverride.setDaemonConfigurations(Collections.<Parameter>emptyList()); expectedEmrClusterDefinition.setDaemonConfigurations(emrClusterDefinitionOverride.getDaemonConfigurations());
scriptDefinitionMaster.setScriptLocation("scriptDefinitionMasterLocation1"); scriptDefinitionMaster.setScriptArguments(Arrays.asList("scriptDefinitionMasterArg1")); emrClusterDefinition.getCustomBootstrapActionMaster().add(scriptDefinitionMaster); scriptDefinitionMaster.setScriptName("scriptDefinitionMasterName2"); scriptDefinitionMaster.setScriptLocation("scriptDefinitionMasterLocation2"); emrClusterDefinition.getCustomBootstrapActionMaster().add(scriptDefinitionMaster);
if (emrClusterDefinitionOverride.getCustomBootstrapActionMaster() != null) emrClusterDefinition.setCustomBootstrapActionMaster(emrClusterDefinitionOverride.getCustomBootstrapActionMaster());
if (emrClusterDefinitionOverride.getCustomBootstrapActionMaster() != null) emrClusterDefinition.setCustomBootstrapActionMaster(emrClusterDefinitionOverride.getCustomBootstrapActionMaster());
lhsCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); List<ScriptDefinition> rhsCustomBootstrapActionMaster; rhsCustomBootstrapActionMaster = ((that.customBootstrapActionMaster!= null)?that.getCustomBootstrapActionMaster():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "customBootstrapActionMaster", lhsCustomBootstrapActionMaster), LocatorUtils.property(thatLocator, "customBootstrapActionMaster", rhsCustomBootstrapActionMaster), lhsCustomBootstrapActionMaster, rhsCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null), (that.customBootstrapActionMaster!= null))) { return false;
lhsCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); List<ScriptDefinition> rhsCustomBootstrapActionMaster; rhsCustomBootstrapActionMaster = ((that.customBootstrapActionMaster!= null)?that.getCustomBootstrapActionMaster():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "customBootstrapActionMaster", lhsCustomBootstrapActionMaster), LocatorUtils.property(thatLocator, "customBootstrapActionMaster", rhsCustomBootstrapActionMaster), lhsCustomBootstrapActionMaster, rhsCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null), (that.customBootstrapActionMaster!= null))) { return false;
lhsCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); List<ScriptDefinition> rhsCustomBootstrapActionMaster; rhsCustomBootstrapActionMaster = ((that.customBootstrapActionMaster!= null)?that.getCustomBootstrapActionMaster():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "customBootstrapActionMaster", lhsCustomBootstrapActionMaster), LocatorUtils.property(thatLocator, "customBootstrapActionMaster", rhsCustomBootstrapActionMaster), lhsCustomBootstrapActionMaster, rhsCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null), (that.customBootstrapActionMaster!= null))) { return false;
theCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); strategy.appendField(locator, this, "customBootstrapActionMaster", buffer, theCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null));
theCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); strategy.appendField(locator, this, "customBootstrapActionMaster", buffer, theCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null));
theCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); strategy.appendField(locator, this, "customBootstrapActionMaster", buffer, theCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null));
theCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "customBootstrapActionMaster", theCustomBootstrapActionMaster), currentHashCode, theCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null));
theCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "customBootstrapActionMaster", theCustomBootstrapActionMaster), currentHashCode, theCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null));
theCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "customBootstrapActionMaster", theCustomBootstrapActionMaster), currentHashCode, theCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null));
if (customBootstrapActionMasterShouldBeCopiedAndSet == Boolean.TRUE) { List<ScriptDefinition> sourceCustomBootstrapActionMaster; sourceCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); @SuppressWarnings("unchecked") List<ScriptDefinition> copyCustomBootstrapActionMaster = ((List<ScriptDefinition> ) strategy.copy(LocatorUtils.property(locator, "customBootstrapActionMaster", sourceCustomBootstrapActionMaster), sourceCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null)));
if (customBootstrapActionMasterShouldBeCopiedAndSet == Boolean.TRUE) { List<ScriptDefinition> sourceCustomBootstrapActionMaster; sourceCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); @SuppressWarnings("unchecked") List<ScriptDefinition> copyCustomBootstrapActionMaster = ((List<ScriptDefinition> ) strategy.copy(LocatorUtils.property(locator, "customBootstrapActionMaster", sourceCustomBootstrapActionMaster), sourceCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null)));
if (customBootstrapActionMasterShouldBeCopiedAndSet == Boolean.TRUE) { List<ScriptDefinition> sourceCustomBootstrapActionMaster; sourceCustomBootstrapActionMaster = ((this.customBootstrapActionMaster!= null)?this.getCustomBootstrapActionMaster():null); @SuppressWarnings("unchecked") List<ScriptDefinition> copyCustomBootstrapActionMaster = ((List<ScriptDefinition> ) strategy.copy(LocatorUtils.property(locator, "customBootstrapActionMaster", sourceCustomBootstrapActionMaster), sourceCustomBootstrapActionMaster, (this.customBootstrapActionMaster!= null)));