Search in sources :

Example 1 with KeytabConfigurationRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.kerberos.KeytabConfigurationRequest in project cloudbreak by hortonworks.

the class ClusterUpscaleActions method configureKeytabsAction.

@Bean(name = "RECONFIGURE_KEYTABS_STATE")
public Action<?, ?> configureKeytabsAction() {
    return new AbstractClusterUpscaleAction<>(UploadUpscaleRecipesResult.class) {

        @Override
        protected void doExecute(ClusterUpscaleContext context, UploadUpscaleRecipesResult payload, Map<Object, Object> variables) {
            if (context.isSinglePrimaryGateway() && ClusterManagerType.CLOUDERA_MANAGER.equals(context.getClusterManagerType())) {
                KeytabConfigurationRequest keytabConfigurationRequest = new KeytabConfigurationRequest(context.getStackId());
                sendEvent(context, keytabConfigurationRequest.selector(), keytabConfigurationRequest);
            } else {
                KeytabConfigurationSuccess keytabConfigurationSuccess = new KeytabConfigurationSuccess(context.getStackId());
                sendEvent(context, keytabConfigurationSuccess.selector(), keytabConfigurationSuccess);
            }
        }
    };
}
Also used : KeytabConfigurationRequest(com.sequenceiq.cloudbreak.reactor.api.event.kerberos.KeytabConfigurationRequest) KeytabConfigurationSuccess(com.sequenceiq.cloudbreak.reactor.api.event.kerberos.KeytabConfigurationSuccess) Map(java.util.Map) HashMap(java.util.HashMap) UploadUpscaleRecipesResult(com.sequenceiq.cloudbreak.reactor.api.event.recipe.UploadUpscaleRecipesResult) Bean(org.springframework.context.annotation.Bean)

Example 2 with KeytabConfigurationRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.kerberos.KeytabConfigurationRequest in project cloudbreak by hortonworks.

the class KeytabConfigurationHandlerTest method shouldNotUpdateKeytabs.

@Test
public void shouldNotUpdateKeytabs() throws Exception {
    KeytabConfigurationRequest keytabConfigurationRequest = new KeytabConfigurationRequest(STACK_ID);
    Stack stack = mock(Stack.class);
    when(stackService.getByIdWithListsInTransaction(STACK_ID)).thenReturn(stack);
    victim.accept(new Event<>(keytabConfigurationRequest));
    verifyNoMoreInteractions(hostOrchestrator);
    verify(eventBus).notify(anyString(), any(Event.class));
}
Also used : KeytabConfigurationRequest(com.sequenceiq.cloudbreak.reactor.api.event.kerberos.KeytabConfigurationRequest) Event(reactor.bus.Event) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 3 with KeytabConfigurationRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.kerberos.KeytabConfigurationRequest in project cloudbreak by hortonworks.

the class KeytabConfigurationHandlerTest method shouldUpdateKeytabs.

@Test
public void shouldUpdateKeytabs() throws Exception {
    KeytabConfigurationRequest keytabConfigurationRequest = new KeytabConfigurationRequest(STACK_ID);
    Stack stack = aStack();
    Optional<KerberosConfig> kerberosConfig = of(mock(KerberosConfig.class));
    GatewayConfig gatewayConfig = mock(GatewayConfig.class);
    when(stackService.getByIdWithListsInTransaction(STACK_ID)).thenReturn(stack);
    when(kerberosConfigService.get(ENVIRONMENT_CRN, STACK_NAME)).thenReturn(kerberosConfig);
    when(environmentConfigProvider.isChildEnvironment(ENVIRONMENT_CRN)).thenReturn(true);
    when(kerberosDetailService.keytabsShouldBeUpdated(CLOUD_PLATFORM, true, kerberosConfig)).thenReturn(true);
    when(gatewayConfigService.getPrimaryGatewayConfig(stack)).thenReturn(gatewayConfig);
    when(keytabProvider.getServiceKeytabResponse(stack, gatewayConfig)).thenReturn(mock(ServiceKeytabResponse.class));
    when(secretService.getByResponse(any())).thenReturn(KEYTABS_IN_BASE64);
    victim.accept(new Event<>(keytabConfigurationRequest));
    verify(hostOrchestrator).uploadKeytabs(any(), any(), any());
    verify(eventBus).notify(anyString(), any(Event.class));
}
Also used : KeytabConfigurationRequest(com.sequenceiq.cloudbreak.reactor.api.event.kerberos.KeytabConfigurationRequest) KerberosConfig(com.sequenceiq.cloudbreak.dto.KerberosConfig) Event(reactor.bus.Event) ServiceKeytabResponse(com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabResponse) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) Test(org.junit.Test)

Aggregations

KeytabConfigurationRequest (com.sequenceiq.cloudbreak.reactor.api.event.kerberos.KeytabConfigurationRequest)3 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 Test (org.junit.Test)2 Event (reactor.bus.Event)2 KerberosConfig (com.sequenceiq.cloudbreak.dto.KerberosConfig)1 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)1 KeytabConfigurationSuccess (com.sequenceiq.cloudbreak.reactor.api.event.kerberos.KeytabConfigurationSuccess)1 UploadUpscaleRecipesResult (com.sequenceiq.cloudbreak.reactor.api.event.recipe.UploadUpscaleRecipesResult)1 ServiceKeytabResponse (com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabResponse)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1