Search in sources :

Example 1 with BlueprintProcessingException

use of com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException in project cloudbreak by hortonworks.

the class StackRequestToBlueprintPreparationObjectConverter method convert.

@Override
public BlueprintPreparationObject convert(StackV2Request source) {
    try {
        IdentityUser identityUser = userDetailsService.getDetails(source.getOwner(), UserFilterField.USERID);
        FlexSubscription flexSubscription = getFlexSubscription(source);
        String smartsenseSubscriptionId = getSmartsenseSubscriptionId(source, flexSubscription);
        KerberosConfig kerberosConfig = getKerberosConfig(source);
        LdapConfig ldapConfig = getLdapConfig(source, identityUser);
        FileSystemConfigurationView fileSystemConfigurationView = getFileSystemConfigurationView(source);
        Set<RDSConfig> rdsConfigs = getRdsConfigs(source, identityUser);
        Blueprint blueprint = getBlueprint(source, identityUser);
        BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(blueprint.getBlueprintText());
        Set<HostgroupView> hostgroupViews = getHostgroupViews(source);
        BlueprintView blueprintView = new BlueprintView(blueprint.getBlueprintText(), blueprintStackInfo.getVersion(), blueprintStackInfo.getType());
        GeneralClusterConfigs generalClusterConfigs = generalClusterConfigsProvider.generalClusterConfigs(source, identityUser);
        return BlueprintPreparationObject.Builder.builder().withFlexSubscription(flexSubscription).withRdsConfigs(rdsConfigs).withHostgroupViews(hostgroupViews).withBlueprintView(blueprintView).withStackRepoDetailsHdpVersion(blueprintStackInfo.getVersion()).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigs).withSmartSenseSubscriptionId(smartsenseSubscriptionId).withLdapConfig(ldapConfig).withKerberosConfig(kerberosConfig).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) GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) CloudbreakServiceException(com.sequenceiq.cloudbreak.service.CloudbreakServiceException) KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) IOException(java.io.IOException) IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig) BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) FlexSubscription(com.sequenceiq.cloudbreak.domain.FlexSubscription) FileSystemConfigurationView(com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView) HostgroupView(com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView)

Example 2 with BlueprintProcessingException

use of com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException 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 3 with BlueprintProcessingException

use of com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException in project cloudbreak by hortonworks.

the class KerberosBlueprintService method extendBlueprintWithKerberos.

public BlueprintTextProcessor extendBlueprintWithKerberos(BlueprintTextProcessor blueprint, Map<String, String> kerberosEnv, String domains, Boolean useUdp, Integer kpropPort, boolean forced) {
    try {
        String krb5Config = FileReaderUtils.readFileFromClasspath("kerberos/krb5-conf-template.conf");
        krb5Config = krb5Config.replaceAll("udp_preference_limit_content", useUdp ? "0" : "1");
        if (kpropPort != null) {
            krb5Config = krb5Config.replaceAll("iprop_enable_content", "true");
            krb5Config = krb5Config.replaceAll("iprop_port_content", kpropPort.toString());
        } else {
            krb5Config = krb5Config.replaceAll("iprop_enable_content", "false");
            krb5Config = krb5Config.replaceAll("iprop_port_content", "8888");
        }
        SiteConfigurations configs = SiteConfigurations.getEmptyConfiguration();
        Map<String, String> krb5Conf = new HashMap<>();
        krb5Conf.put("domains", domains);
        krb5Conf.put("manage_krb5_conf", "true");
        if (!useUdp || kpropPort != null) {
            krb5Conf.put("content", krb5Config.toString());
        }
        configs.addSiteConfiguration("kerberos-env", kerberosEnv);
        configs.addSiteConfiguration("krb5-conf", krb5Conf);
        return blueprint.addComponentToHostgroups("KERBEROS_CLIENT", hg -> true).setSecurityType("KERBEROS").extendBlueprintGlobalConfiguration(configs, forced);
    } catch (IOException e) {
        throw new BlueprintProcessingException("Failed to extend blueprint with kerberos configurations.", e);
    }
}
Also used : BlueprintProcessingException(com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException) HashMap(java.util.HashMap) SiteConfigurations(com.sequenceiq.cloudbreak.blueprint.configuration.SiteConfigurations) IOException(java.io.IOException)

Aggregations

BlueprintProcessingException (com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException)3 IOException (java.io.IOException)3 BlueprintView (com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView)2 FileSystemConfigurationView (com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView)2 BlueprintStackInfo (com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo)2 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)2 LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)2 CloudbreakServiceException (com.sequenceiq.cloudbreak.service.CloudbreakServiceException)2 SiteConfigurations (com.sequenceiq.cloudbreak.blueprint.configuration.SiteConfigurations)1 HdfConfigs (com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs)1 HostgroupView (com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView)1 GeneralClusterConfigs (com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs)1 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)1 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)1 FlexSubscription (com.sequenceiq.cloudbreak.domain.FlexSubscription)1 KerberosConfig (com.sequenceiq.cloudbreak.domain.KerberosConfig)1 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)1 SmartSenseSubscription (com.sequenceiq.cloudbreak.domain.SmartSenseSubscription)1