Search in sources :

Example 6 with Recipe

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);
    }
}
Also used : RecipeScript(com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript) Recipe(com.sequenceiq.cloudbreak.domain.Recipe) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) HostGroup(com.sequenceiq.cloudbreak.domain.HostGroup) IOException(java.io.IOException)

Example 7 with Recipe

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);
    }
}
Also used : RecipeScript(com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript) Recipe(com.sequenceiq.cloudbreak.domain.Recipe) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) HostGroup(com.sequenceiq.cloudbreak.domain.HostGroup) IOException(java.io.IOException)

Example 8 with Recipe

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);
}
Also used : Recipe(com.sequenceiq.cloudbreak.domain.Recipe) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 9 with 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;
}
Also used : Recipe(com.sequenceiq.cloudbreak.domain.Recipe) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 10 with 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);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Recipe(com.sequenceiq.cloudbreak.domain.Recipe)

Aggregations

Recipe (com.sequenceiq.cloudbreak.domain.Recipe)20 RecipeScript (com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript)5 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)5 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)5 IOException (java.io.IOException)3 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)2 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)2 ArrayList (java.util.ArrayList)2 FileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)1 RecipeRequest (com.sequenceiq.cloudbreak.api.model.RecipeRequest)1 FileSystemConfigurator (com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemConfigurator)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 Constraint (com.sequenceiq.cloudbreak.domain.Constraint)1 RecipeModel (com.sequenceiq.cloudbreak.orchestrator.model.RecipeModel)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1