use of com.sequenceiq.freeipa.flow.freeipa.repair.changeprimarygw.ChangePrimaryGatewayService in project cloudbreak by hortonworks.
the class ChangePrimaryGatewayActions method orchestrationAction.
@Bean(name = "CHANGE_PRIMARY_GATEWAY_METADATA_STATE")
public Action<?, ?> orchestrationAction() {
return new AbstractChangePrimaryGatewayAction<>(ChangePrimaryGatewaySelectionSuccess.class) {
@Inject
private ChangePrimaryGatewayService changePrimaryGatewayService;
@Override
protected void doExecute(ChangePrimaryGatewayContext context, ChangePrimaryGatewaySelectionSuccess payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.REPAIR_IN_PROGRESS, "Changing the primary gateway metadata");
try {
changePrimaryGatewayService.changePrimaryGatewayMetadata(stack, payload.getFormerPrimaryGatewayInstanceId(), payload.getNewPrimaryGatewayInstanceId());
sendEvent(context, CHANGE_PRIMARY_GATEWAY_METADATA_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
} catch (Exception e) {
LOGGER.error("Failed to update the primary gateway metadata", e);
sendEvent(context, CHANGE_PRIMARY_GATEWAY_METADATA_FAILED_EVENT.selector(), new ChangePrimaryGatewayFailureEvent(stack.getId(), "Updating metadata", Set.of(), Map.of(), e));
}
}
};
}
Aggregations