Search in sources :

Example 1 with HdfConfigs

use of com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs in project cloudbreak by hortonworks.

the class StackToBlueprintPreparationObjectConverter method convert.

@Override
public BlueprintPreparationObject convert(Stack source) {
    try {
        Optional<SmartSenseSubscription> aDefault = smartSenseSubscriptionService.getDefault();
        Cluster cluster = clusterService.getById(source.getCluster().getId());
        FileSystem fileSystem = cluster.getFileSystem();
        LdapConfig ldapConfig = cluster.getLdapConfig();
        StackRepoDetails hdpRepo = clusterComponentConfigProvider.getHDPRepo(cluster.getId());
        String stackRepoDetailsHdpVersion = hdpRepo != null ? hdpRepo.getHdpVersion() : null;
        Map<String, List<InstanceMetaData>> groupInstances = instanceGroupMetadataCollector.collectMetadata(source);
        HdfConfigs hdfConfigs = hdfConfigProvider.createHdfConfig(cluster.getHostGroups(), groupInstances, cluster.getBlueprint().getBlueprintText());
        BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(cluster.getBlueprint().getBlueprintText());
        FileSystemConfigurationView fileSystemConfigurationView = null;
        if (source.getCluster().getFileSystem() != null) {
            fileSystemConfigurationView = new FileSystemConfigurationView(fileSystemConfigurationProvider.fileSystemConfiguration(fileSystem, source), fileSystem == null ? false : fileSystem.isDefaultFs());
        }
        IdentityUser identityUser = userDetailsService.getDetails(cluster.getOwner(), UserFilterField.USERID);
        return BlueprintPreparationObject.Builder.builder().withFlexSubscription(source.getFlexSubscription()).withRdsConfigs(postgresConfigService.createRdsConfigIfNeeded(source, cluster)).withHostgroups(hostGroupService.getByCluster(cluster.getId())).withGateway(cluster.getGateway()).withBlueprintView(new BlueprintView(cluster, blueprintStackInfo)).withStackRepoDetailsHdpVersion(stackRepoDetailsHdpVersion).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigsProvider.generalClusterConfigs(source, cluster, identityUser)).withSmartSenseSubscriptionId(aDefault.isPresent() ? aDefault.get().getSubscriptionId() : null).withLdapConfig(ldapConfig).withHdfConfigs(hdfConfigs).withKerberosConfig(cluster.isSecure() ? cluster.getKerberosConfig() : null).build();
    } catch (BlueprintProcessingException e) {
        throw new CloudbreakServiceException(e.getMessage(), e);
    } catch (IOException e) {
        throw new CloudbreakServiceException(e.getMessage(), e);
    }
}
Also used : BlueprintProcessingException(com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) HdfConfigs(com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs) SmartSenseSubscription(com.sequenceiq.cloudbreak.domain.SmartSenseSubscription) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) CloudbreakServiceException(com.sequenceiq.cloudbreak.service.CloudbreakServiceException) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) IOException(java.io.IOException) LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig) IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) FileSystemConfigurationView(com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView) List(java.util.List)

Example 2 with HdfConfigs

use of com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs in project cloudbreak by hortonworks.

the class BlueprintTemplateProcessorTest method testMustacheGeneratorShouldEscapeNifiHtmlBasedContentsQuotes.

@Test
public void testMustacheGeneratorShouldEscapeNifiHtmlBasedContentsQuotes() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-mustache-test.bp");
    Cluster cluster = cluster();
    BlueprintStackInfo blueprintStackInfo = new BlueprintStackInfo("hdp", "2.4");
    GeneralClusterConfigs generalClusterConfigs = generalClusterConfigs();
    generalClusterConfigs.setClusterName("dummyCluster");
    generalClusterConfigs.setStackName("dummyCluster");
    Map<String, Object> properties = new HashMap<>();
    properties.put("S3_BUCKET", "testbucket");
    HdfConfigs hdfConfigs = new HdfConfigs("<property name=\"Node Identity 1\">CN=hostname-2, OU=NIFI</property>", Optional.empty());
    BlueprintPreparationObject blueprintPreparationObject = BlueprintPreparationObject.Builder.builder().withRdsConfigs(cluster.getRdsConfigs()).withGateway(cluster.getGateway()).withLdapConfig(cluster.getLdapConfig()).withGeneralClusterConfigs(generalClusterConfigs).withBlueprintView(new BlueprintView(testBlueprint, new Json(properties), blueprintStackInfo.getVersion(), blueprintStackInfo.getType())).withHdfConfigs(hdfConfigs).build();
    String result = underTest.process(testBlueprint, blueprintPreparationObject, Maps.newHashMap());
    assertTrue(result.contains("\"content\": \"<property name=\\\"Node Identity 1\\\">CN=hostname-2, OU=NIFI</property>\""));
    assertFalse(result.contains("\"content\": \"<property name=\"Node Identity 1\">CN=hostname-2, OU=NIFI</property>\""));
}
Also used : HdfConfigs(com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs) BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs) HashMap(java.util.HashMap) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Json(com.sequenceiq.cloudbreak.domain.json.Json) Test(org.junit.Test)

Aggregations

HdfConfigs (com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs)2 BlueprintView (com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView)2 BlueprintStackInfo (com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo)2 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)2 BlueprintPreparationObject (com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)1 BlueprintProcessingException (com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException)1 FileSystemConfigurationView (com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView)1 GeneralClusterConfigs (com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs)1 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)1 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)1 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)1 LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)1 SmartSenseSubscription (com.sequenceiq.cloudbreak.domain.SmartSenseSubscription)1 Json (com.sequenceiq.cloudbreak.domain.json.Json)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.service.CloudbreakServiceException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Test (org.junit.Test)1