Search in sources :

Example 81 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class ClusterServicesRestartHandler method accept.

@Override
public void accept(Event<ClusterServicesRestartRequest> event) {
    ClusterServicesRestartRequest request = event.getData();
    ClusterServicesRestartResult result;
    int requestId;
    try {
        Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId());
        Optional<Stack> datalakeStack = datalakeService.getDatalakeStackByDatahubStack(stack);
        CmTemplateProcessor blueprintProcessor = getCmTemplateProcessor(stack.getCluster());
        if (datalakeStack.isPresent() && clusterServicesRestartService.isRDCRefreshNeeded(stack, datalakeStack.get())) {
            LOGGER.info("Deploying client config and restarting services");
            requestId = clusterServicesRestartService.refreshClusterOnRestart(stack, datalakeStack.get(), blueprintProcessor);
        } else {
            LOGGER.info("Restarting services");
            requestId = apiConnectors.getConnector(stack).clusterModificationService().restartClusterServices();
        }
        result = new ClusterServicesRestartResult(request, requestId);
    } catch (Exception e) {
        result = new ClusterServicesRestartResult(e.getMessage(), e, request);
    }
    eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Also used : ClusterServicesRestartResult(com.sequenceiq.cloudbreak.reactor.api.event.cluster.restart.ClusterServicesRestartResult) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ClusterServicesRestartRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.restart.ClusterServicesRestartRequest) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 82 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class StackStatusCheckerJob method getComputeHostGroups.

private Set<String> getComputeHostGroups(Cluster cluster) {
    String blueprintText = cluster.getBlueprint().getBlueprintText();
    CmTemplateProcessor blueprintProcessor = cmTemplateProcessorFactory.get(blueprintText);
    Versioned blueprintVersion = () -> blueprintProcessor.getVersion().get();
    return blueprintProcessor.getComputeHostGroups(blueprintVersion);
}
Also used : Versioned(com.sequenceiq.cloudbreak.common.type.Versioned) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)

Example 83 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class DasRdsConfigProvider method isRdsConfigNeeded.

@Override
protected boolean isRdsConfigNeeded(Blueprint blueprint, boolean hasGateway) {
    String blueprintText = blueprint.getBlueprintText();
    CmTemplateProcessor blueprintProcessor = cmTemplateProcessorFactory.get(blueprintText);
    return blueprintProcessor.isCMComponentExistsInBlueprint("DAS_EVENT_PROCESSOR") || blueprintProcessor.isCMComponentExistsInBlueprint("DAS_WEBAPP");
}
Also used : CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)

Example 84 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class HueRdsConfigProvider method isRdsConfigNeedForHueServer.

private boolean isRdsConfigNeedForHueServer(Blueprint blueprint) {
    String blueprintText = blueprint.getBlueprintText();
    CmTemplateProcessor blueprintProcessor = cmTemplateProcessorFactory.get(blueprintText);
    return blueprintProcessor.isCMComponentExistsInBlueprint("HUE_SERVER") && blueprintProcessor.isCMComponentExistsInBlueprint("HUE_LOAD_BALANCER");
}
Also used : CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)

Example 85 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class ProfilerAdminConfigProvider method isRdsConfigNeedForProfilerAdmin.

private boolean isRdsConfigNeedForProfilerAdmin(Blueprint blueprint) {
    String blueprintText = blueprint.getBlueprintText();
    CmTemplateProcessor cmTemplateProcessor = cmTemplateProcessorFactory.get(blueprintText);
    return cmTemplateProcessor.isCMComponentExistsInBlueprint("PROFILER_ADMIN_AGENT");
}
Also used : CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)

Aggregations

CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)149 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)115 Test (org.junit.Test)84 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)75 List (java.util.List)46 ArrayList (java.util.ArrayList)33 Test (org.junit.jupiter.api.Test)19 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)18 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)15 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)13 HashSet (java.util.HashSet)12 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)10 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)10 Set (java.util.Set)10 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)9 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)8 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)8 Map (java.util.Map)8 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)7 Collectors (java.util.stream.Collectors)7