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;
}
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);
}
}
Aggregations