Search in sources :

Example 1 with KerberosConfigUpdateService

use of com.sequenceiq.freeipa.service.config.KerberosConfigUpdateService in project cloudbreak by hortonworks.

the class FreeIpaUpscaleActions method updateKerberosNameserversConfigAction.

@Bean(name = "UPSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_STATE")
public Action<?, ?> updateKerberosNameserversConfigAction() {
    return new AbstractUpscaleAction<>(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, UPSCALE_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, UPSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_FAILED_EVENT.selector(), new UpscaleFailureEvent(stack.getId(), "Updating kerberos nameserver config", Set.of(), Map.of(), e));
            }
        }
    };
}
Also used : StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) UpscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent) KerberosConfigUpdateService(com.sequenceiq.freeipa.service.config.KerberosConfigUpdateService) Map(java.util.Map) ClientErrorException(javax.ws.rs.ClientErrorException) OperationException(com.sequenceiq.cloudbreak.service.OperationException) Stack(com.sequenceiq.freeipa.entity.Stack) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Bean(org.springframework.context.annotation.Bean)

Example 2 with KerberosConfigUpdateService

use of com.sequenceiq.freeipa.service.config.KerberosConfigUpdateService 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));
            }
        }
    };
}
Also used : StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) KerberosConfigUpdateService(com.sequenceiq.freeipa.service.config.KerberosConfigUpdateService) DownscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent) Map(java.util.Map) ClientErrorException(javax.ws.rs.ClientErrorException) Stack(com.sequenceiq.freeipa.entity.Stack) Bean(org.springframework.context.annotation.Bean)

Aggregations

Stack (com.sequenceiq.freeipa.entity.Stack)2 StackContext (com.sequenceiq.freeipa.flow.stack.StackContext)2 StackEvent (com.sequenceiq.freeipa.flow.stack.StackEvent)2 KerberosConfigUpdateService (com.sequenceiq.freeipa.service.config.KerberosConfigUpdateService)2 Map (java.util.Map)2 ClientErrorException (javax.ws.rs.ClientErrorException)2 Bean (org.springframework.context.annotation.Bean)2 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)1 OperationException (com.sequenceiq.cloudbreak.service.OperationException)1 DownscaleFailureEvent (com.sequenceiq.freeipa.flow.freeipa.downscale.event.DownscaleFailureEvent)1 UpscaleFailureEvent (com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent)1