Search in sources :

Example 1 with ValidateCloudStorageRequest

use of com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageRequest in project cloudbreak by hortonworks.

the class FreeIpaUpscaleActions method validateFreeIpaCloudStorage.

@Bean(name = "UPSCALE_VALIDATING_CLOUD_STORAGE_STATE")
public Action<?, ?> validateFreeIpaCloudStorage() {
    return new AbstractUpscaleAction<>(StackEvent.class) {

        @Override
        protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
            Stack stack = context.getStack();
            stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Validating cloud storage");
            ValidateCloudStorageRequest request = new ValidateCloudStorageRequest(stack.getId());
            sendEvent(context, request.selector(), request);
        }
    };
}
Also used : StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) ValidateCloudStorageRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageRequest) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) Map(java.util.Map) Stack(com.sequenceiq.freeipa.entity.Stack) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Bean(org.springframework.context.annotation.Bean)

Example 2 with ValidateCloudStorageRequest

use of com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageRequest in project cloudbreak by hortonworks.

the class ValidateCloudStorageHandler method doAccept.

@Override
protected Selectable doAccept(HandlerEvent<ValidateCloudStorageRequest> event) {
    ValidateCloudStorageRequest request = event.getData();
    Selectable response;
    try {
        Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId());
        freeIpaCloudStorageValidationService.validate(stack);
        response = new ValidateCloudStorageSuccess(request.getResourceId());
    } catch (Exception e) {
        LOGGER.error("FreeIPA cloud storage validation failed", e);
        response = new ValidateCloudStorageFailed(request.getResourceId(), e);
    }
    return response;
}
Also used : ValidateCloudStorageRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageRequest) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ValidateCloudStorageFailed(com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageFailed) ValidateCloudStorageSuccess(com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageSuccess) Stack(com.sequenceiq.freeipa.entity.Stack)

Aggregations

Stack (com.sequenceiq.freeipa.entity.Stack)2 ValidateCloudStorageRequest (com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageRequest)2 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 ValidateCloudStorageFailed (com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageFailed)1 ValidateCloudStorageSuccess (com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageSuccess)1 StackContext (com.sequenceiq.freeipa.flow.stack.StackContext)1 StackEvent (com.sequenceiq.freeipa.flow.stack.StackEvent)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1