Search in sources :

Example 1 with BlueprintValidator

use of com.sequenceiq.cloudbreak.template.validation.BlueprintValidator in project cloudbreak by hortonworks.

the class ClusterDecorator method validateBlueprintIfRequired.

private void validateBlueprintIfRequired(Cluster subject, ClusterV4Request request, Stack stack) {
    BlueprintValidator blueprintValidator = blueprintValidatorFactory.createBlueprintValidator(subject.getBlueprint());
    blueprintValidator.validate(subject.getBlueprint(), subject.getHostGroups(), stack.getInstanceGroups(), request.getValidateBlueprint());
}
Also used : BlueprintValidator(com.sequenceiq.cloudbreak.template.validation.BlueprintValidator)

Example 2 with BlueprintValidator

use of com.sequenceiq.cloudbreak.template.validation.BlueprintValidator in project cloudbreak by hortonworks.

the class ClusterOperationService method recreate.

public FlowIdentifier recreate(Stack stack, String blueprintName, Set<HostGroup> hostGroups, boolean validateBlueprint) throws TransactionExecutionException {
    return transactionService.required(() -> {
        checkBlueprintIdAndHostGroups(blueprintName, hostGroups);
        Stack stackWithLists = stackService.getByIdWithListsInTransaction(stack.getId());
        Cluster cluster = stackWithLists.getCluster();
        Blueprint blueprint = blueprintService.getByNameForWorkspace(blueprintName, stack.getWorkspace());
        if (!clusterService.withEmbeddedClusterManagerDB(cluster)) {
            throw new BadRequestException("Cluster Manager doesn't support resetting external DB automatically. To reset Cluster Manager schema you " + "must first drop and then create it using DDL scripts from /opt/cloudera/cm/schema/postgresql/");
        }
        BlueprintValidator blueprintValidator = blueprintValidatorFactory.createBlueprintValidator(blueprint);
        blueprintValidator.validate(blueprint, hostGroups, stackWithLists.getInstanceGroups(), validateBlueprint);
        clusterService.prepareCluster(hostGroups, blueprint, stackWithLists, cluster);
        clusterService.updateClusterStatusByStackId(stack.getId(), DetailedStackStatus.CLUSTER_RECREATE_REQUESTED);
        return triggerClusterInstall(stackWithLists);
    });
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) BlueprintValidator(com.sequenceiq.cloudbreak.template.validation.BlueprintValidator) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Aggregations

BlueprintValidator (com.sequenceiq.cloudbreak.template.validation.BlueprintValidator)2 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1