use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent in project cloudbreak by hortonworks.
the class DownscaleStackCollectResourcesResultToDownscaleFailureEventConverter method convert.
@Override
public DownscaleFailureEvent convert(Object payload) {
DownscaleStackCollectResourcesResult downscaleStackCollectResourcesResult = (DownscaleStackCollectResourcesResult) payload;
DownscaleFailureEvent event = new DownscaleFailureEvent(downscaleStackCollectResourcesResult.getResourceId(), "Collecting resources", Set.of(), Map.of(), new Exception("Payload failed: " + payload));
return event;
}
use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent in project cloudbreak by hortonworks.
the class FreeIpaDownscaleActions method updateEnvironmentStackConfigAction.
@Bean(name = "DOWNSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_STATE")
public Action<?, ?> updateEnvironmentStackConfigAction() {
return new AbstractDownscaleAction<>(StackEvent.class) {
@Inject
private EnvironmentEndpoint environmentEndpoint;
@Inject
private WebApplicationExceptionMessageExtractor webApplicationExceptionMessageExtractor;
@Override
protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Updating environment stack config");
try {
if (!isRepair(variables) || !isChainedAction(variables) || isFinalChain(variables)) {
ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> environmentEndpoint.updateConfigsInEnvironmentByCrn(stack.getEnvironmentCrn()));
}
sendEvent(context, DOWNSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
} catch (ClientErrorException e) {
String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e);
LOGGER.error("Failed to update the stack config due to {}", errorMessage, e);
sendEvent(context, DOWNSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FAILED_EVENT.selector(), new DownscaleFailureEvent(stack.getId(), "Updating environment stack config", Set.of(), Map.of(), e));
} catch (Exception e) {
LOGGER.error("Failed to update the stack config", e);
sendEvent(context, DOWNSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FAILED_EVENT.selector(), new DownscaleFailureEvent(stack.getId(), "Updating environment stack config", Set.of(), Map.of(), e));
}
}
};
}
use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent in project cloudbreak by hortonworks.
the class FreeIpaDownscaleActions method updateKerberosNameserversConfigAction.
@Bean(name = "DOWNSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_STATE")
public Action<?, ?> updateKerberosNameserversConfigAction() {
return new AbstractDownscaleAction<>(StackEvent.class) {
@Inject
private KerberosConfigUpdateService kerberosConfigUpdateService;
@Override
protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Updating kerberos nameserver config");
try {
kerberosConfigUpdateService.updateNameservers(stack.getId());
sendEvent(context, DOWNSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
} catch (Exception e) {
LOGGER.error("Failed to update the kerberos nameserver config", e);
sendEvent(context, DOWNSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_FAILED_EVENT.selector(), new DownscaleFailureEvent(stack.getId(), "Updating kerberos nameserver config", Set.of(), Map.of(), e));
}
}
};
}
use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent in project cloudbreak by hortonworks.
the class DownscaleStackResultToDownscaleFailureEventConverter method convert.
@Override
public DownscaleFailureEvent convert(Object payload) {
DownscaleStackResult downscaleStackResult = (DownscaleStackResult) payload;
DownscaleFailureEvent event = new DownscaleFailureEvent(downscaleStackResult.getResourceId(), "Downscale Stack", Set.of(), Map.of(), new Exception("Payload failed: " + payload));
return event;
}
use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent in project cloudbreak by hortonworks.
the class RemoveDnsResponseToDownscaleFailureEventConverter method convert.
@Override
public DownscaleFailureEvent convert(Object payload) {
RemoveDnsResponse removeDnsResponse = (RemoveDnsResponse) payload;
DownscaleFailureEvent event = new DownscaleFailureEvent(removeDnsResponse.getResourceId(), "DNS record removal", removeDnsResponse.getDnsCleanupSuccess(), removeDnsResponse.getDnsCleanupFailed(), new Exception("Payload failed: " + payload));
return event;
}
Aggregations