use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.
the class RecipeEngine method addContainerExecutorScripts.
private void addContainerExecutorScripts(Stack stack, Iterable<HostGroup> hostGroups) {
try {
Cluster cluster = stack.getCluster();
if (cluster != null && ExecutorType.CONTAINER.equals(cluster.getExecutorType())) {
for (HostGroup hostGroup : hostGroups) {
String script = FileReaderUtils.readFileFromClasspath("scripts/configure-container-executor.sh");
RecipeScript recipeScript = new RecipeScript(script, RecipeType.POST_CLUSTER_INSTALL);
Recipe recipe = recipeBuilder.buildRecipes("getConfigurationEntries-container-executor", Collections.singletonList(recipeScript)).get(0);
hostGroup.addRecipe(recipe);
}
}
} catch (IOException e) {
LOGGER.warn("Cannot getConfigurationEntries container executor", e);
}
}
use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.
the class RecipeEngine method addSmartSenseRecipe.
private void addSmartSenseRecipe(Stack stack, Iterable<HostGroup> hostGroups) {
try {
Cluster cluster = stack.getCluster();
String blueprintText = cluster.getBlueprint().getBlueprintText();
if (smartsenseConfigurationLocator.smartsenseConfigurable(smartSenseSubscriptionService.getDefault())) {
for (HostGroup hostGroup : hostGroups) {
if (isComponentPresent(blueprintText, "HST_AGENT", hostGroup)) {
String script = FileReaderUtils.readFileFromClasspath("scripts/smartsense-capture-schedule.sh");
RecipeScript recipeScript = new RecipeScript(script, RecipeType.POST_CLUSTER_INSTALL);
Recipe recipe = recipeBuilder.buildRecipes("smartsense-capture-schedule", Collections.singletonList(recipeScript)).get(0);
hostGroup.addRecipe(recipe);
break;
}
}
}
} catch (IOException e) {
LOGGER.warn("Cannot create SmartSense caputre schedule setter recipe", e);
}
}
use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.
the class RecipeEngine method addFsRecipes.
private void addFsRecipes(Stack stack, Iterable<HostGroup> hostGroups) throws CloudbreakException {
String orchestrator = stack.getOrchestrator().getType();
if (SALT.equals(orchestrator)) {
Cluster cluster = stack.getCluster();
String blueprintText = cluster.getBlueprint().getBlueprintText();
FileSystem fs = cluster.getFileSystem();
if (fs != null) {
try {
addFsRecipesToHostGroups(stack.getCredential(), hostGroups, blueprintText, fs);
} catch (IOException e) {
throw new CloudbreakException("can not add FS recipes to host groups", e);
}
}
addHDFSRecipe(cluster, blueprintText, hostGroups);
}
}
use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.
the class ConstraintTemplateService method delete.
private void delete(ConstraintTemplate constraintTemplate) {
authorizationService.hasWritePermission(constraintTemplate);
LOGGER.debug("Deleting constraint template. {} - {}", new Object[] { constraintTemplate.getId(), constraintTemplate.getName() });
List<Cluster> clusters = clusterRepository.findAllClustersForConstraintTemplate(constraintTemplate.getId());
if (clusters.isEmpty()) {
if (ResourceStatus.USER_MANAGED.equals(constraintTemplate.getStatus())) {
constraintTemplateRepository.delete(constraintTemplate);
} else {
constraintTemplate.setName(NameUtil.postfixWithTimestamp(constraintTemplate.getName()));
constraintTemplate.setStatus(ResourceStatus.DEFAULT_DELETED);
constraintTemplateRepository.save(constraintTemplate);
}
} else if (isRunningClusterReferToTemplate(clusters)) {
throw new BadRequestException(String.format("There are stacks associated with template '%s'. Please remove these before deleting the template.", constraintTemplate.getName()));
} else {
constraintTemplate.setName(NameUtil.postfixWithTimestamp(constraintTemplate.getName()));
constraintTemplate.setDeleted(true);
if (ResourceStatus.DEFAULT.equals(constraintTemplate.getStatus())) {
constraintTemplate.setStatus(ResourceStatus.DEFAULT_DELETED);
}
constraintTemplateRepository.save(constraintTemplate);
}
}
use of com.sequenceiq.cloudbreak.domain.Cluster in project cloudbreak by hortonworks.
the class ClusterCreationService method clusterInstallationFinished.
public void clusterInstallationFinished(StackView stackView) {
String ambariIp = stackUtil.extractAmbariIp(stackView);
clusterService.updateClusterStatusByStackId(stackView.getId(), AVAILABLE);
stackUpdater.updateStackStatus(stackView.getId(), DetailedStackStatus.AVAILABLE, "Cluster creation finished.");
flowMessageService.fireEventAndLog(stackView.getId(), Msg.AMBARI_CLUSTER_BUILT, AVAILABLE.name(), ambariIp);
Cluster cluster = clusterService.getById(stackView.getClusterView().getId());
clusterService.cleanupKerberosCredential(cluster);
if (cluster.getEmailNeeded()) {
emailSenderService.sendProvisioningSuccessEmail(cluster.getOwner(), stackView.getClusterView().getEmailTo(), ambariIp, cluster.getName(), cluster.getGateway().getEnableGateway());
flowMessageService.fireEventAndLog(stackView.getId(), Msg.AMBARI_CLUSTER_NOTIFICATION_EMAIL, AVAILABLE.name());
}
}
Aggregations