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;
}
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"));
}
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));
}
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;
}
Aggregations