use of com.sequenceiq.cloudbreak.service.upgrade.sync.operationresult.CmSyncOperationStatus in project cloudbreak by hortonworks.
the class CmSyncHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<CmSyncRequest> event) {
CmSyncRequest request = event.getData();
try {
Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId());
Set<Image> candidateImages = cmSyncImageCollectorService.collectImages(request.getFlowTriggerUserCrn(), stack, request.getCandidateImageUuids());
CmSyncOperationSummary cmSyncOperationSummary = cmSyncerService.syncFromCmToDb(stack, candidateImages);
CmSyncOperationStatus cmSyncOperationStatus = cmSyncOperationSummary.getSyncOperationStatus();
if (!cmSyncOperationStatus.hasSucceeded()) {
LOGGER.debug("Reading CM and active parcel versions from CM server encountered failures. Details: {}", cmSyncOperationStatus.getMessage());
Exception e = new CloudbreakServiceException(cmSyncOperationStatus.getMessage());
return new CmSyncResult(cmSyncOperationStatus.getMessage(), e, request);
}
return new CmSyncResult(request, cmSyncOperationStatus.getMessage());
} catch (Exception e) {
LOGGER.warn("Reading CM and active parcel versions from CM server resulted in error ", e);
String message = String.format("unexpected error: %s", e.getMessage());
return new CmSyncResult(message, new CloudbreakServiceException(message, e), request);
}
}
use of com.sequenceiq.cloudbreak.service.upgrade.sync.operationresult.CmSyncOperationStatus in project cloudbreak by hortonworks.
the class CmSyncerService method syncInternal.
private CmSyncOperationSummary syncInternal(Stack stack, Set<Image> candidateImages) {
CmSyncOperationResult cmSyncOperationResult = new CmSyncOperationResult(cmInstalledComponentFinderService.findCmRepoComponent(stack, candidateImages), cmInstalledComponentFinderService.findParcelComponents(stack, candidateImages));
LOGGER.debug("Synced CM versions and found components: {}", cmSyncOperationResult);
componentPersistingService.persistComponentsToDb(stack, cmSyncOperationResult);
CmSyncOperationStatus cmSyncOperationStatus = cmSyncOperationSummaryService.evaluate(cmSyncOperationResult);
mixedPackageVersionService.validatePackageVersions(stack.getId(), cmSyncOperationResult, candidateImages);
LOGGER.info("CM sync was executed, summary: {}", cmSyncOperationStatus);
return new CmSyncOperationSummary(cmSyncOperationStatus, cmSyncOperationResult);
}
Aggregations