use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class DiagnosticsPreFlightCheckHandler 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();
Stack stack = stackService.getByIdWithListsInTransaction(resourceId);
Set<InstanceMetaData> instanceMetaDataSet = instanceMetaDataService.findNotTerminatedForStack(resourceId);
instanceMetaDataSet.stream().filter(im -> im.getInstanceMetadataType() == InstanceMetadataType.GATEWAY_PRIMARY).forEach(instance -> executeNetworkReport(stack, instance));
return DiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_DIAGNOSTICS_INIT_EVENT.selector()).withParameters(parameters).build();
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class BootstrapMachineHandler method accept.
@Override
public void accept(Event<BootstrapMachinesRequest> event) {
BootstrapMachinesRequest request = event.getData();
Selectable response;
try {
bootstrapService.bootstrap(request.getResourceId());
response = new BootstrapMachinesSuccess(request.getResourceId());
} catch (Exception e) {
LOGGER.error("Bootstrap failed", e);
response = new BootstrapMachinesFailed(request.getResourceId(), e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class ClusterProxyUpdateRegistrationHandler method accept.
@Override
public void accept(Event<ClusterProxyUpdateRegistrationRequest> event) {
ClusterProxyUpdateRegistrationRequest request = event.getData();
Selectable response;
try {
clusterProxyService.updateFreeIpaRegistrationAndWait(request.getResourceId(), request.getInstanceIds());
response = new ClusterProxyUpdateRegistrationSuccess(request.getResourceId());
} catch (Exception e) {
LOGGER.error("Updating Cluster Proxy registration has failed", e);
response = new ClusterProxyUpdateRegistrationFailed(request.getResourceId(), e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class HostMetadataSetupHandler method accept.
@Override
public void accept(Event<HostMetadataSetupRequest> event) {
StackEvent request = event.getData();
LOGGER.debug("Host metadata setup request {}", request);
Selectable response;
try {
hostMetadataSetup.setupHostMetadata(request.getResourceId());
response = new HostMetadataSetupSuccess(request.getResourceId());
} catch (Exception e) {
LOGGER.debug("Host metadata setup failed", e);
response = new HostMetadataSetupFailed(request.getResourceId(), e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class InstallFreeIpaServicesHandler method accept.
@Override
public void accept(Event<InstallFreeIpaServicesRequest> event) {
StackEvent request = event.getData();
Selectable response;
try {
freeIpaInstallService.installFreeIpa(request.getResourceId());
response = new InstallFreeIpaServicesSuccess(request.getResourceId());
} catch (Exception e) {
LOGGER.error("FreeIPA service install failed", e);
response = new InstallFreeIpaServicesFailed(request.getResourceId(), e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Aggregations