Search in sources :

Example 1 with BaseSaltJobRunner

use of com.sequenceiq.cloudbreak.orchestrator.salt.poller.BaseSaltJobRunner in project cloudbreak by hortonworks.

the class SaltOrchestrator method resetAmbari.

@Override
public void resetAmbari(GatewayConfig gatewayConfig, Set<String> target, Set<Node> allNodes, ExitCriteriaModel exitCriteriaModel) throws CloudbreakOrchestratorException {
    try (SaltConnector saltConnector = new SaltConnector(gatewayConfig, restDebug)) {
        BaseSaltJobRunner baseSaltJobRunner = new BaseSaltJobRunner(target, allNodes) {

            @Override
            public String submit(SaltConnector saltConnector) {
                return SaltStates.ambariReset(saltConnector, new Compound(getTarget(), CompoundType.HOST));
            }
        };
        OrchestratorBootstrap saltJobIdTracker = new SaltJobIdTracker(saltConnector, baseSaltJobRunner);
        Callable<Boolean> saltJobRunBootstrapRunner = runner(saltJobIdTracker, exitCriteria, exitCriteriaModel);
        Future<Boolean> saltJobRunBootstrapFuture = parallelOrchestratorComponentRunner.submit(saltJobRunBootstrapRunner);
        saltJobRunBootstrapFuture.get();
    } catch (Exception e) {
        LOGGER.error("Error occurred during reset", e);
        throw new CloudbreakOrchestratorFailedException(e);
    }
}
Also used : CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) OrchestratorBootstrap(com.sequenceiq.cloudbreak.orchestrator.OrchestratorBootstrap) SaltJobIdTracker(com.sequenceiq.cloudbreak.orchestrator.salt.poller.SaltJobIdTracker) BaseSaltJobRunner(com.sequenceiq.cloudbreak.orchestrator.salt.poller.BaseSaltJobRunner) Compound(com.sequenceiq.cloudbreak.orchestrator.salt.client.target.Compound) SaltConnector(com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

OrchestratorBootstrap (com.sequenceiq.cloudbreak.orchestrator.OrchestratorBootstrap)1 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)1 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 SaltConnector (com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector)1 Compound (com.sequenceiq.cloudbreak.orchestrator.salt.client.target.Compound)1 BaseSaltJobRunner (com.sequenceiq.cloudbreak.orchestrator.salt.poller.BaseSaltJobRunner)1 SaltJobIdTracker (com.sequenceiq.cloudbreak.orchestrator.salt.poller.SaltJobIdTracker)1 IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1