Search in sources :

Example 1 with ParameterizedStateRunner

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

the class SaltTelemetryOrchestrator method validateCloudStorage.

@Override
public void validateCloudStorage(List<GatewayConfig> allGateways, Set<Node> allNodes, Set<String> targetHostNames, Map<String, Object> parameters, ExitCriteriaModel exitCriteriaModel) throws CloudbreakOrchestratorException {
    GatewayConfig primaryGateway = saltService.getPrimaryGatewayConfig(allGateways);
    try (SaltConnector sc = saltService.createSaltConnector(primaryGateway)) {
        runValidation(sc, new ParameterizedStateRunner(targetHostNames, allNodes, TELEMETRY_CLOUD_STORAGE_TEST, parameters), exitCriteriaModel);
        LOGGER.debug("Completed validating cloud storage");
    } catch (CloudbreakOrchestratorException e) {
        LOGGER.warn("CloudbreakOrchestratorException occurred during cloud storage validation", e);
        throw e;
    } catch (ExecutionException e) {
        LOGGER.warn("Error occurred during cloud storage validation", e);
        if (e.getCause() instanceof CloudbreakOrchestratorFailedException) {
            throw (CloudbreakOrchestratorFailedException) e.getCause();
        }
        throw new CloudbreakOrchestratorFailedException(e.getMessage(), e);
    } catch (Exception e) {
        LOGGER.warn("Error occurred during cloud storage validation", e);
        throw new CloudbreakOrchestratorFailedException(e.getMessage(), e);
    }
}
Also used : CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) ParameterizedStateRunner(com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ParameterizedStateRunner) ConcurrentParameterizedStateRunner(com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner) ExecutionException(java.util.concurrent.ExecutionException) SaltConnector(com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) UncheckedIOException(java.io.UncheckedIOException) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Example 2 with ParameterizedStateRunner

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

the class SaltTelemetryOrchestrator method upgradeMetering.

@Override
public void upgradeMetering(List<GatewayConfig> allGateways, Set<Node> nodes, ExitCriteriaModel exitModel, String upgradeFromDate, String customRpmUrl) throws CloudbreakOrchestratorFailedException {
    Map<String, Object> upgradeParameters = Map.of("metering", Map.of("upgradeDateFrom", upgradeFromDate, "customRpmUrl", customRpmUrl, "failHard", true));
    GatewayConfig primaryGateway = saltService.getPrimaryGatewayConfig(allGateways);
    Set<String> targetHostnames = nodes.stream().map(Node::getHostname).collect(Collectors.toSet());
    try (SaltConnector sc = saltService.createSaltConnector(primaryGateway)) {
        ParameterizedStateRunner stateRunner = new ParameterizedStateRunner(targetHostnames, nodes, METERING_UPGRADE, upgradeParameters);
        OrchestratorBootstrap saltJobIdTracker = new SaltJobIdTracker(sc, stateRunner, false);
        Callable<Boolean> saltJobRunBootstrapRunner = saltRunner.runner(saltJobIdTracker, exitCriteria, exitModel, telemetrySaltRetryConfig.getMeteringUpgrade(), false);
        saltJobRunBootstrapRunner.call();
    } catch (Exception e) {
        LOGGER.info("Error occurred during metering upgrade.", e);
        throw new CloudbreakOrchestratorFailedException(e);
    }
}
Also used : OrchestratorBootstrap(com.sequenceiq.cloudbreak.orchestrator.OrchestratorBootstrap) SaltJobIdTracker(com.sequenceiq.cloudbreak.orchestrator.salt.poller.SaltJobIdTracker) SaltConnector(com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) UncheckedIOException(java.io.UncheckedIOException) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) ParameterizedStateRunner(com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ParameterizedStateRunner) ConcurrentParameterizedStateRunner(com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)

Aggregations

CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)2 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)2 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)2 SaltConnector (com.sequenceiq.cloudbreak.orchestrator.salt.client.SaltConnector)2 ConcurrentParameterizedStateRunner (com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner)2 ParameterizedStateRunner (com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ParameterizedStateRunner)2 IOException (java.io.IOException)2 UncheckedIOException (java.io.UncheckedIOException)2 ExecutionException (java.util.concurrent.ExecutionException)2 OrchestratorBootstrap (com.sequenceiq.cloudbreak.orchestrator.OrchestratorBootstrap)1 SaltJobIdTracker (com.sequenceiq.cloudbreak.orchestrator.salt.poller.SaltJobIdTracker)1