use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsEnsureMachineUserHandler method executeOperation.
@Override
public Selectable executeOperation(HandlerEvent<DiagnosticsCollectionEvent> event) throws Exception {
DiagnosticsCollectionEvent data = event.getData();
Long resourceId = data.getResourceId();
String resourceCrn = data.getResourceCrn();
DiagnosticParameters parameters = data.getParameters();
Map<String, Object> parameterMap = parameters.toMap();
LOGGER.debug("Diagnostics collection ensure machine user operation started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
if (DiagnosticsDestination.SUPPORT.equals(parameters.getDestination())) {
LOGGER.debug("Generating databus credential if required for diagnostics support destination.");
DataBusCredential credential = altusMachineUserService.getOrCreateDataBusCredentialIfNeeded(resourceId);
parameters.setSupportBundleDbusAccessKey(credential.getAccessKey());
parameters.setSupportBundleDbusPrivateKey(credential.getPrivateKey());
}
return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_COLLECTION_EVENT.selector()).withParameters(parameters).withHosts(parameters.getHosts()).withHostGroups(parameters.getHostGroups()).withExcludeHosts(parameters.getExcludeHosts()).build();
}
use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsInitHandler method executeOperation.
@Override
public Selectable executeOperation(HandlerEvent<DiagnosticsCollectionEvent> event) throws Exception {
DiagnosticsCollectionEvent data = event.getData();
Long resourceId = data.getResourceId();
String resourceCrn = data.getResourceCrn();
DiagnosticParameters parameters = data.getParameters();
if (StringUtils.isBlank(parameters.getUuid())) {
LOGGER.debug("UUID is empty for diagnostics... Use flow ID as UUID.");
parameters.setUuid(event.getEvent().getHeaders().get(FlowConstants.FLOW_ID));
}
Map<String, Object> parameterMap = parameters.toMap();
LOGGER.debug("Diagnostics collection initialization started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
diagnosticsOperationsService.init(resourceId, parameters);
return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_UPGRADE_EVENT.selector()).withParameters(parameters).withHosts(parameters.getHosts()).withHostGroups(parameters.getHostGroups()).withExcludeHosts(parameters.getExcludeHosts()).build();
}
use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsSaltPillarUpdateHandler method executeOperation.
@Override
public Selectable executeOperation(HandlerEvent<DiagnosticsCollectionEvent> event) throws Exception {
DiagnosticsCollectionEvent data = event.getData();
Long resourceId = data.getResourceId();
String resourceCrn = data.getResourceCrn();
DiagnosticParameters parameters = data.getParameters();
telemetryUpgradeService.upgradeTelemetrySaltPillars(resourceId, Set.of(TelemetryComponentType.CDP_TELEMETRY));
return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_SALT_STATE_UPDATE_EVENT.selector()).withParameters(parameters).build();
}
use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsVmPreFlightCheckHandler method executeOperation.
@Override
public Selectable executeOperation(HandlerEvent<DiagnosticsCollectionEvent> event) throws Exception {
DiagnosticsCollectionEvent data = event.getData();
Long resourceId = data.getResourceId();
String resourceCrn = data.getResourceCrn();
DiagnosticParameters parameters = data.getParameters();
Map<String, Object> parameterMap = parameters.toMap();
LOGGER.debug("Diagnostics collection VM preflight check started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
if (!DiagnosticsDestination.ENG.equals(parameters.getDestination())) {
diagnosticsOperationsService.vmPreflightCheck(resourceId, parameters);
} else {
LOGGER.debug("Diagnostics VM preflight check skipped.");
}
return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_ENSURE_MACHINE_USER_EVENT.selector()).withParameters(parameters).withHosts(parameters.getHosts()).withHostGroups(parameters.getHostGroups()).withExcludeHosts(parameters.getExcludeHosts()).build();
}
use of com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent in project cloudbreak by hortonworks.
the class DiagnosticsCleanupHandler method executeOperation.
@Override
public Selectable executeOperation(HandlerEvent<DiagnosticsCollectionEvent> event) throws Exception {
DiagnosticsCollectionEvent data = event.getData();
Long resourceId = data.getResourceId();
String resourceCrn = data.getResourceCrn();
DiagnosticParameters parameters = data.getParameters();
Map<String, Object> parameterMap = parameters.toMap();
LOGGER.debug("Diagnostics cleanup started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
diagnosticsOperationsService.cleanup(resourceId, parameters);
return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(FINISH_DIAGNOSTICS_COLLECTION_EVENT.selector()).withParameters(parameters).withHosts(parameters.getHosts()).withHostGroups(parameters.getHostGroups()).withExcludeHosts(parameters.getExcludeHosts()).build();
}
Aggregations