use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class ClusterUpgradeHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<ClusterUpgradeRequest> event) {
LOGGER.debug("Accepting Cluster upgrade event..");
ClusterUpgradeRequest request = event.getData();
Long stackId = request.getResourceId();
Selectable result;
try {
Stack stack = stackService.getByIdWithClusterInTransaction(stackId);
Optional<String> remoteDataContext = getRemoteDataContext(stack);
ClusterApi connector = clusterApiConnectors.getConnector(stack);
Set<ClusterComponent> components = parcelService.getParcelComponentsByBlueprint(stack);
connector.upgradeClusterRuntime(components, request.isPatchUpgrade(), remoteDataContext);
ParcelOperationStatus parcelOperationStatus = parcelService.removeUnusedParcelComponents(stack, components);
if (parcelOperationStatus.getFailed().isEmpty()) {
result = new ClusterUpgradeSuccess(request.getResourceId());
} else {
LOGGER.info("There are failed parcel removals: {}", parcelOperationStatus);
CloudbreakException exception = new CloudbreakException(format("Failed to remove the following parcels: %s", parcelOperationStatus.getFailed()));
result = new ClusterUpgradeFailedEvent(request.getResourceId(), exception, DetailedStackStatus.CLUSTER_UPGRADE_FAILED);
}
} catch (Exception e) {
LOGGER.error("Cluster upgrade event failed", e);
result = new ClusterUpgradeFailedEvent(request.getResourceId(), e, DetailedStackStatus.CLUSTER_UPGRADE_FAILED);
}
return result;
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class ExecutePostClusterManagerStartRecipesHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<ExecutePostClusterManagerStartRecipesRequest> event) {
Long stackId = event.getData().getResourceId();
Selectable response;
try {
clusterBuilderService.executePostClusterManagerStartRecipes(stackId);
response = new ExecutePostClusterManagerStartRecipesSuccess(stackId);
} catch (RuntimeException | CloudbreakException e) {
LOGGER.error("ExecutePostClusterManagerStartRecipesHandler step failed with the following message: {}", e.getMessage());
response = new ExecutePostClusterManagerStartRecipesFailed(stackId, e);
}
return response;
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class PrepareExtendedTemplateHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<PrepareExtendedTemplateRequest> event) {
Long stackId = event.getData().getResourceId();
Selectable response;
try {
clusterBuilderService.prepareExtendedTemplate(stackId);
response = new PrepareExtendedTemplateSuccess(stackId);
} catch (RuntimeException e) {
LOGGER.error("PrepareExtendedTemplateHandler step failed with the following message: {}", e.getMessage());
response = new PrepareExtendedTemplateFailed(stackId, e);
}
return response;
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class SuppressClusterWarningsHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SuppressClusterWarningsRequest> event) {
Long stackId = event.getData().getResourceId();
Selectable response;
try {
clusterBuilderService.suppressWarnings(stackId);
response = new SuppressClusterWarningsSuccess(stackId);
} catch (RuntimeException e) {
LOGGER.error("SuppressClusterWarningsHandler step failed with the following message: {}", e.getMessage());
response = new SuppressClusterWarningsFailed(stackId, e);
}
return response;
}
use of com.sequenceiq.cloudbreak.common.event.Selectable in project cloudbreak by hortonworks.
the class UpdateClusterConfigHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<UpdateClusterConfigRequest> event) {
Long stackId = event.getData().getResourceId();
Selectable response;
try {
clusterBuilderService.updateConfig(stackId);
response = new UpdateClusterConfigSuccess(stackId);
} catch (RuntimeException e) {
LOGGER.error("UpdateClusterConfigHandler step failed with the following message: {}", e.getMessage());
response = new UpdateClusterConfigFailed(stackId, e);
}
return response;
}
Aggregations