Search in sources :

Example 1 with FreeIpaConfigView

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

the class FreeIpaOrchestrationConfigService method getSaltConfig.

@VisibleForTesting
SaltConfig getSaltConfig(Stack stack, Set<Node> hosts) throws CloudbreakOrchestratorFailedException {
    SaltConfig saltConfig = new SaltConfig();
    Map<String, SaltPillarProperties> servicePillarConfig = saltConfig.getServicePillarConfig();
    FreeIpaConfigView freeIpaConfigView = freeIpaConfigService.createFreeIpaConfigs(stack, hosts);
    servicePillarConfig.put("freeipa", new SaltPillarProperties("/freeipa/init.sls", Collections.singletonMap("freeipa", freeIpaConfigView.toMap())));
    servicePillarConfig.put("discovery", new SaltPillarProperties("/discovery/init.sls", singletonMap("platform", stack.getCloudPlatform())));
    servicePillarConfig.putAll(telemetryConfigService.createTelemetryPillarConfig(stack));
    servicePillarConfig.putAll(proxyConfigService.createProxyPillarConfig(stack.getEnvironmentCrn()));
    servicePillarConfig.putAll(tagConfigService.createTagsPillarConfig(stack));
    return saltConfig;
}
Also used : SaltConfig(com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig) FreeIpaConfigView(com.sequenceiq.freeipa.service.freeipa.config.FreeIpaConfigView) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 2 with FreeIpaConfigView

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

the class FreeIpaOrchestationConfigServiceTest method testGetSaltConfig.

@Test
public void testGetSaltConfig() throws Exception {
    Stack stack = mock(Stack.class);
    FreeIpaConfigView freeIpaConfigView = mock(FreeIpaConfigView.class);
    Map freeIpaConfigViewMap = mock(Map.class);
    when(freeIpaConfigService.createFreeIpaConfigs(any(), any())).thenReturn(freeIpaConfigView);
    when(stack.getCloudPlatform()).thenReturn(CLOUD_PLATFORM);
    when(freeIpaConfigView.toMap()).thenReturn(freeIpaConfigViewMap);
    when(telemetryConfigService.createTelemetryPillarConfig(any())).thenReturn(Map.of());
    when(proxyConfigService.createProxyPillarConfig(any())).thenReturn(Map.of());
    when(tagConfigService.createTagsPillarConfig(any())).thenReturn(Map.of());
    SaltConfig saltConfig = underTest.getSaltConfig(stack, Set.of());
    Map<String, SaltPillarProperties> servicePillarConfig = saltConfig.getServicePillarConfig();
    assertNotNull(servicePillarConfig);
    SaltPillarProperties freeIpaProperties = servicePillarConfig.get("freeipa");
    assertNotNull(freeIpaProperties);
    assertEquals("/freeipa/init.sls", freeIpaProperties.getPath());
    assertEquals(freeIpaConfigViewMap, freeIpaProperties.getProperties().get("freeipa"));
    SaltPillarProperties discoveryProperties = servicePillarConfig.get("discovery");
    assertNotNull(discoveryProperties);
    assertEquals("/discovery/init.sls", discoveryProperties.getPath());
    assertEquals(CLOUD_PLATFORM, discoveryProperties.getProperties().get("platform"));
}
Also used : SaltConfig(com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig) FreeIpaConfigView(com.sequenceiq.freeipa.service.freeipa.config.FreeIpaConfigView) Map(java.util.Map) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Example 3 with FreeIpaConfigView

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

the class SaltConfigProviderTest method testGetSaltConfig.

@Test
public void testGetSaltConfig() throws Exception {
    Stack stack = mock(Stack.class);
    when(stack.getCcmParameters()).thenReturn(new CcmConnectivityParameters(new DefaultCcmV2JumpgateParameters()));
    FreeIpaConfigView freeIpaConfigView = mock(FreeIpaConfigView.class);
    Map freeIpaConfigViewMap = mock(Map.class);
    when(freeIpaConfigService.createFreeIpaConfigs(any(), any())).thenReturn(freeIpaConfigView);
    when(stack.getCloudPlatform()).thenReturn(CLOUD_PLATFORM);
    when(freeIpaConfigView.toMap()).thenReturn(freeIpaConfigViewMap);
    when(telemetryConfigService.createTelemetryPillarConfig(any())).thenReturn(Map.of());
    when(proxyConfigService.createProxyPillarConfig(any())).thenReturn(Map.of());
    when(tagConfigService.createTagsPillarConfig(any())).thenReturn(Map.of());
    when(ccmParametersConfigService.createCcmParametersPillarConfig(any(), any())).thenReturn(Map.of(PILLAR, new SaltPillarProperties(PILLARPATH, Map.of(PILLARKEY, PILLARVALUE))));
    SaltConfig saltConfig = underTest.getSaltConfig(stack, Set.of());
    Map<String, SaltPillarProperties> servicePillarConfig = saltConfig.getServicePillarConfig();
    assertNotNull(servicePillarConfig);
    SaltPillarProperties freeIpaProperties = servicePillarConfig.get("freeipa");
    assertNotNull(freeIpaProperties);
    assertEquals("/freeipa/init.sls", freeIpaProperties.getPath());
    assertEquals(freeIpaConfigViewMap, freeIpaProperties.getProperties().get("freeipa"));
    SaltPillarProperties discoveryProperties = servicePillarConfig.get("discovery");
    assertNotNull(discoveryProperties);
    assertEquals("/discovery/init.sls", discoveryProperties.getPath());
    assertEquals(CLOUD_PLATFORM, discoveryProperties.getProperties().get("platform"));
    SaltPillarProperties pillarProperties = servicePillarConfig.get(PILLAR);
    assertNotNull(pillarProperties);
    assertEquals(PILLARPATH, pillarProperties.getPath());
    assertEquals(PILLARVALUE, pillarProperties.getProperties().get(PILLARKEY));
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) DefaultCcmV2JumpgateParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters) SaltConfig(com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig) FreeIpaConfigView(com.sequenceiq.freeipa.service.freeipa.config.FreeIpaConfigView) Map(java.util.Map) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Example 4 with FreeIpaConfigView

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

the class SaltConfigProvider method getSaltConfig.

public SaltConfig getSaltConfig(Stack stack, Set<Node> hosts) throws CloudbreakOrchestratorFailedException {
    SaltConfig saltConfig = new SaltConfig();
    Map<String, SaltPillarProperties> servicePillarConfig = saltConfig.getServicePillarConfig();
    FreeIpaConfigView freeIpaConfigView = freeIpaConfigService.createFreeIpaConfigs(stack, hosts);
    servicePillarConfig.put("freeipa", new SaltPillarProperties("/freeipa/init.sls", singletonMap("freeipa", freeIpaConfigView.toMap())));
    servicePillarConfig.put("discovery", new SaltPillarProperties("/discovery/init.sls", singletonMap("platform", stack.getCloudPlatform())));
    servicePillarConfig.putAll(telemetryConfigService.createTelemetryPillarConfig(stack));
    servicePillarConfig.putAll(proxyConfigService.createProxyPillarConfig(stack.getEnvironmentCrn()));
    servicePillarConfig.putAll(tagConfigService.createTagsPillarConfig(stack));
    servicePillarConfig.putAll(getCcmPillarProperties(stack));
    return saltConfig;
}
Also used : SaltConfig(com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig) FreeIpaConfigView(com.sequenceiq.freeipa.service.freeipa.config.FreeIpaConfigView) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)

Aggregations

SaltConfig (com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig)4 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)4 FreeIpaConfigView (com.sequenceiq.freeipa.service.freeipa.config.FreeIpaConfigView)4 Stack (com.sequenceiq.freeipa.entity.Stack)2 Map (java.util.Map)2 Test (org.junit.jupiter.api.Test)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 CcmConnectivityParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters)1 DefaultCcmV2JumpgateParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters)1