Search in sources :

Example 1 with OrchestratorStateRetryParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateRetryParams in project cloudbreak by hortonworks.

the class SshKeyService method createSshStateParams.

private OrchestratorStateParams createSshStateParams(Stack stack, String user, KeyPair keyPair, String authKeysComment, String saltState) {
    Cluster cluster = stack.getCluster();
    Set<Node> nodes = stackUtil.collectReachableNodes(stack);
    OrchestratorStateParams stateParams = new OrchestratorStateParams();
    stateParams.setState(saltState);
    stateParams.setPrimaryGatewayConfig(gatewayConfigService.getGatewayConfig(stack, stack.getPrimaryGatewayInstance(), stack.getCluster().hasGateway()));
    stateParams.setTargetHostNames(nodes.stream().map(Node::getHostname).collect(Collectors.toSet()));
    stateParams.setAllNodes(nodes);
    stateParams.setExitCriteriaModel(ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(stack.getId(), cluster.getId()));
    stateParams.setStateParams(createSshParams(user, keyPair, authKeysComment));
    OrchestratorStateRetryParams retryParams = new OrchestratorStateRetryParams();
    retryParams.setMaxRetry(SSH_KEY_OPERATION_RETRY_COUNT);
    stateParams.setStateRetryParams(retryParams);
    return stateParams;
}
Also used : OrchestratorStateRetryParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateRetryParams) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) OrchestratorStateParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)

Example 2 with OrchestratorStateRetryParams

use of com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateRetryParams in project cloudbreak by hortonworks.

the class SaltOrchestrator method runOrchestratorState.

@Override
public void runOrchestratorState(OrchestratorStateParams stateParams) throws CloudbreakOrchestratorFailedException {
    try (SaltConnector sc = saltService.createSaltConnector(stateParams.getPrimaryGatewayConfig())) {
        StateRunner stateRunner = createStateRunner(stateParams);
        OrchestratorBootstrap saltJobIdTracker = new SaltJobIdTracker(sc, stateRunner);
        Optional<OrchestratorStateRetryParams> stateRetryParams = stateParams.getStateRetryParams();
        Callable<Boolean> saltJobRunBootstrapRunner = stateRetryParams.isPresent() ? saltRunner.runner(saltJobIdTracker, exitCriteria, stateParams.getExitCriteriaModel(), stateRetryParams.get()) : saltRunner.runner(saltJobIdTracker, exitCriteria, stateParams.getExitCriteriaModel());
        saltJobRunBootstrapRunner.call();
    } catch (Exception e) {
        LOGGER.error(stateParams.getErrorMessage(), e);
        throw new CloudbreakOrchestratorFailedException(e.getMessage(), e);
    }
}
Also used : OrchestratorStateRetryParams(com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateRetryParams) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) OrchestratorBootstrap(com.sequenceiq.cloudbreak.orchestrator.OrchestratorBootstrap) SaltJobIdTracker(com.sequenceiq.cloudbreak.orchestrator.salt.poller.SaltJobIdTracker) HighStateRunner(com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.HighStateRunner) ParameterizedStateRunner(com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ParameterizedStateRunner) ConcurrentParameterizedStateRunner(com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner) StateRunner(com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.StateRunner) SaltConnector(com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector) NotFoundException(com.sequenceiq.cloudbreak.common.exception.NotFoundException) CloudbreakOrchestratorTimeoutException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorTimeoutException) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)

Aggregations

OrchestratorStateRetryParams (com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateRetryParams)2 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 NotFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException)1 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1 OrchestratorBootstrap (com.sequenceiq.cloudbreak.orchestrator.OrchestratorBootstrap)1 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)1 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 CloudbreakOrchestratorTimeoutException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorTimeoutException)1 OrchestratorStateParams (com.sequenceiq.cloudbreak.orchestrator.host.OrchestratorStateParams)1 SaltConnector (com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector)1 SaltJobIdTracker (com.sequenceiq.cloudbreak.orchestrator.salt.poller.SaltJobIdTracker)1 ConcurrentParameterizedStateRunner (com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner)1 HighStateRunner (com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.HighStateRunner)1 ParameterizedStateRunner (com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ParameterizedStateRunner)1 StateRunner (com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.StateRunner)1 IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1