use of com.sequenceiq.cloudbreak.domain.Recipe 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.Recipe 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.Recipe in project cloudbreak by hortonworks.
the class RecipeService method delete.
public void delete(String name, IdentityUser user) {
Recipe recipe = recipeRepository.findByNameInAccount(name, user.getAccount());
if (recipe == null) {
throw new NotFoundException(String.format("Recipe '%s' not found.", name));
}
delete(recipe);
}
use of com.sequenceiq.cloudbreak.domain.Recipe in project cloudbreak by hortonworks.
the class RecipeService method get.
public Recipe get(Long id) {
Recipe recipe = recipeRepository.findOne(id);
if (recipe == null) {
throw new NotFoundException(String.format("Recipe '%s' not found", id));
}
authorizationService.hasReadPermission(recipe);
return recipe;
}
use of com.sequenceiq.cloudbreak.domain.Recipe in project cloudbreak by hortonworks.
the class RecipeController method getPublics.
@Override
public Set<RecipeResponse> getPublics() {
IdentityUser user = authenticatedUserService.getCbUser();
Set<Recipe> recipes = recipeService.retrieveAccountRecipes(user);
return toJsonSet(recipes);
}
Aggregations