use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.
the class FreeIpaCloudStorageValidationService method validateCloudStorage.
private void validateCloudStorage(Stack stack, List<GatewayConfig> allGateways, Set<Node> allNodes, StackBasedExitCriteriaModel exitCriteriaModel) throws CloudbreakOrchestratorFailedException {
try {
if (stack.getTelemetry() != null && stack.getTelemetry().isCloudStorageLoggingEnabled()) {
Set<String> targetHostNames = allNodes.stream().map(Node::getHostname).limit(1).collect(Collectors.toSet());
CloudStorageDiagnosticsParameters cloudStorageParameters = diagnosticCloudStorageConverter.loggingToCloudStorageDiagnosticsParameters(stack.getTelemetry().getLogging(), stack.getRegion());
DiagnosticParameters parameters = new DiagnosticParameters();
parameters.setRoot(DiagnosticParameters.TELEMETRY_ROOT);
parameters.setCloudStorageDiagnosticsParameters(cloudStorageParameters);
telemetryOrchestrator.validateCloudStorage(allGateways, allNodes, targetHostNames, parameters.toMap(), exitCriteriaModel);
}
} catch (CloudbreakOrchestratorException e) {
String errorMessage = getErrorMessage(stack, "logging");
LOGGER.error(errorMessage, e);
throw new CloudbreakOrchestratorFailedException(errorMessage, e);
}
}
use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.
the class DiagnosticsService method startDiagnosticsCollection.
public FlowIdentifier startDiagnosticsCollection(DiagnosticsCollectionRequest request, String accountId, String userCrn) {
Stack stack = stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(request.getEnvironmentCrn(), accountId);
diagnosticsCollectionValidator.validate(request, stack);
LOGGER.debug("Starting diagnostics collection for FreeIpa. Crn: '{}'", stack.getResourceCrn());
boolean useDbusCnameEndpoint = entitlementService.useDataBusCNameEndpointEnabled(stack.getAccountId());
String databusEndpoint = dataBusEndpointProvider.getDataBusEndpoint(stack.getTelemetry().getDatabusEndpoint(), useDbusCnameEndpoint);
DiagnosticParameters parameters = diagnosticsDataToParameterConverter.convert(request, stack.getTelemetry(), FREEIPA_CLUSTER_TYPE, stack.getAppVersion(), stack.getAccountId(), stack.getRegion(), databusEndpoint);
DiagnosticsCollectionEvent diagnosticsCollectionEvent = DiagnosticsCollectionEvent.builder().withAccepted(new Promise<>()).withResourceId(stack.getId()).withResourceCrn(stack.getResourceCrn()).withSelector(DiagnosticsCollectionStateSelectors.START_DIAGNOSTICS_SALT_VALIDATION_EVENT.selector()).withParameters(parameters).build();
return flowManager.notify(diagnosticsCollectionEvent, getFlowHeaders(userCrn));
}
use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.
the class DiagnosticsUpgradeTelemetryHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException {
// GIVEN
doNothing().when(telemetryUpgradeService).upgradeTelemetryComponent(anyLong(), any(), any());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(UPGRADE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(telemetryUpgradeService, times(1)).upgradeTelemetryComponent(anyLong(), any(), any());
}
use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.
the class DiagnosticsUpgradeTelemetryHandlerTest method testFailureEvent.
@Test
public void testFailureEvent() {
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(UPGRADE_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
Selectable result = underTest.defaultFailureEvent(STACK_ID, new IllegalArgumentException("ex"), new Event<>(event));
assertEquals(FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector(), result.selector());
}
use of com.sequenceiq.common.model.diagnostics.DiagnosticParameters in project cloudbreak by hortonworks.
the class DiagnosticsUploadHandlerTest method testDoAccept.
@Test
public void testDoAccept() throws CloudbreakOrchestratorFailedException {
// GIVEN
doNothing().when(diagnosticsOperationsService).upload(anyLong(), any());
// WHEN
DiagnosticsCollectionEvent event = new DiagnosticsCollectionEvent(UPLOAD_DIAGNOSTICS_EVENT.selector(), STACK_ID, "crn", new DiagnosticParameters());
underTest.doAccept(new HandlerEvent<>(new Event<>(event)));
// THEN
verify(diagnosticsOperationsService, times(1)).upload(anyLong(), any());
}
Aggregations