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