use of com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateRequest in project cloudbreak by hortonworks.
the class UserDataUpdateActions method updateUserData.
@Bean(name = "UPDATE_USERDATA_STATE")
public AbstractUserDataUpdateAction<?> updateUserData() {
return new AbstractUserDataUpdateAction<>(UserDataUpdateRequest.class) {
@Override
protected void doExecute(StackContext context, UserDataUpdateRequest payload, Map<Object, Object> variables) throws Exception {
LOGGER.info("Recreate userdata for new freeipa instances");
setOperationId(variables, payload.getOperationId());
setChainedAction(variables, payload.isChained());
setFinalChain(variables, payload.isFinal());
sendEvent(context, new UserDataUpdateRequest(context.getStack().getId(), payload.getOldTunnel()));
}
@Override
protected Object getFailurePayload(UserDataUpdateRequest payload, Optional<StackContext> flowContext, Exception ex) {
return new UserDataUpdateFailed(payload.getResourceId(), ex);
}
};
}
use of com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateRequest in project cloudbreak by hortonworks.
the class UpgradeCcmFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(UpgradeCcmFlowChainTriggerEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new UpgradeCcmTriggerEvent(UpgradeCcmStateSelector.UPGRADE_CCM_TRIGGER_EVENT.event(), event.getOperationId(), event.getResourceId(), event.getOldTunnel(), event.accepted()).withIsChained(true).withIsFinal(false));
flowEventChain.add(new UserDataUpdateRequest(UpdateUserDataEvents.UPDATE_USERDATA_TRIGGER_EVENT.event(), event.getResourceId(), event.getOldTunnel()).withOperationId(event.getOperationId()).withIsChained(true).withIsFinal(true));
return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
use of com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateRequest in project cloudbreak by hortonworks.
the class UpdateUserDataHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<UserDataUpdateRequest> event) {
UserDataUpdateRequest request = event.getData();
try {
LOGGER.info("Updating userData in the stack's current used image entity...");
switch(request.getOldTunnel()) {
case CCM:
LOGGER.debug("Regenerating user data from request payload.");
userDataService.regenerateUserData(request.getResourceId());
break;
case CCMV2:
LOGGER.debug("Updating Jumpgate flag only.");
userDataService.updateJumpgateFlagOnly(request.getResourceId());
break;
default:
throw new IllegalStateException(String.format("Upgrade from %s is not implemented", request.getOldTunnel()));
}
return new UserDataUpdateSuccess(request.getResourceId());
} catch (Exception e) {
LOGGER.error("Updating user data in the stack's image entity has failed", e);
return new UserDataUpdateFailed(UPDATE_USERDATA_FAILED_EVENT.event(), request.getResourceId(), e);
}
}
Aggregations