Search in sources :

Example 1 with UserDataUpdateOnProviderResult

use of com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateOnProviderResult in project cloudbreak by hortonworks.

the class UpdateUserDataOnProviderHandler method doAccept.

@Override
protected Selectable doAccept(HandlerEvent<UserDataUpdateOnProviderRequest> event) {
    UserDataUpdateOnProviderRequest request = event.getData();
    try {
        LOGGER.info("Updating userData on cloud provider side...");
        CloudConnector<?> connector = cloudPlatformConnectors.get(request.getCloudContext().getPlatformVariant());
        AuthenticatedContext auth = connector.authentication().authenticate(request.getCloudContext(), request.getCloudCredential());
        CloudStack stack = request.getCloudStack();
        connector.resources().updateUserData(auth, stack, request.getCloudResources(), request.getUserData());
        return new UserDataUpdateOnProviderResult(request.getResourceId());
    } catch (Exception e) {
        LOGGER.error("Updating user data on provider side has failed", e);
        return new UserDataUpdateFailed(UPDATE_USERDATA_FAILED_EVENT.event(), request.getResourceId(), e);
    }
}
Also used : UserDataUpdateOnProviderRequest(com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateOnProviderRequest) UserDataUpdateFailed(com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateFailed) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) UserDataUpdateOnProviderResult(com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateOnProviderResult)

Aggregations

AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)1 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)1 UserDataUpdateFailed (com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateFailed)1 UserDataUpdateOnProviderRequest (com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateOnProviderRequest)1 UserDataUpdateOnProviderResult (com.sequenceiq.freeipa.flow.stack.update.event.UserDataUpdateOnProviderResult)1