Search in sources :

Example 1 with FileSystem

use of com.sequenceiq.cloudbreak.domain.FileSystem in project cloudbreak by hortonworks.

the class ClusterRequestToClusterConverterTest method testConvertWithFileSystemDetails.

@Test
public void testConvertWithFileSystemDetails() {
    // GIVEN
    given(conversionService.convert(any(KerberosRequest.class), eq(KerberosConfig.class))).willReturn(new KerberosConfig());
    given(conversionService.convert(any(FileSystemRequest.class), eq(FileSystem.class))).willReturn(new FileSystem());
    // WHEN
    Cluster result = underTest.convert(getRequest("stack/cluster-with-file-system.json"));
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("stack", "blueprint", "creationStarted", "creationFinished", "upSince", "statusReason", "ambariIp", "ambariStackDetails", "certDir", "rdsConfigs", "ldapConfig", "attributes", "blueprintCustomProperties", "uptime", "ambariSecurityMasterKey", "proxyConfig", "extendedBlueprintText"));
}
Also used : FileSystemRequest(com.sequenceiq.cloudbreak.api.model.FileSystemRequest) KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) KerberosRequest(com.sequenceiq.cloudbreak.api.model.KerberosRequest) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Test(org.junit.Test)

Example 2 with FileSystem

use of com.sequenceiq.cloudbreak.domain.FileSystem 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 FileSystem

use of com.sequenceiq.cloudbreak.domain.FileSystem in project cloudbreak by hortonworks.

the class RecipeEngine method addFsRecipes.

private void addFsRecipes(Stack stack, Iterable<HostGroup> hostGroups) throws CloudbreakException {
    String orchestrator = stack.getOrchestrator().getType();
    if (SALT.equals(orchestrator)) {
        Cluster cluster = stack.getCluster();
        String blueprintText = cluster.getBlueprint().getBlueprintText();
        FileSystem fs = cluster.getFileSystem();
        if (fs != null) {
            try {
                addFsRecipesToHostGroups(stack.getCredential(), hostGroups, blueprintText, fs);
            } catch (IOException e) {
                throw new CloudbreakException("can not add FS recipes to host groups", e);
            }
        }
        addHDFSRecipe(cluster, blueprintText, hostGroups);
    }
}
Also used : FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) IOException(java.io.IOException)

Example 4 with FileSystem

use of com.sequenceiq.cloudbreak.domain.FileSystem in project cloudbreak by hortonworks.

the class StackRequestToBlueprintPreparationObjectConverter method getFileSystemConfigurationView.

private FileSystemConfigurationView getFileSystemConfigurationView(StackV2Request source) throws IOException {
    FileSystemConfigurationView fileSystemConfigurationView = null;
    if (source.getCluster().getFileSystem() != null) {
        FileSystem fileSystem = getConversionService().convert(source.getCluster().getFileSystem(), FileSystem.class);
        FileSystemConfiguration fileSystemConfiguration = fileSystemConfigurationProvider.fileSystemConfiguration(fileSystem, null);
        fileSystemConfigurationView = new FileSystemConfigurationView(fileSystemConfiguration, source.getCluster().getFileSystem().isDefaultFs());
    }
    return fileSystemConfigurationView;
}
Also used : FileSystemConfigurationView(com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)

Example 5 with FileSystem

use of com.sequenceiq.cloudbreak.domain.FileSystem in project cloudbreak by hortonworks.

the class ClusterRequestToClusterConverter method convert.

@Override
public Cluster convert(ClusterRequest source) {
    Cluster cluster = new Cluster();
    cluster.setName(source.getName());
    cluster.setStatus(REQUESTED);
    cluster.setDescription(source.getDescription());
    cluster.setEmailNeeded(source.getEmailNeeded());
    cluster.setUserName(source.getUserName());
    cluster.setPassword(source.getPassword());
    cluster.setExecutorType(source.getExecutorType());
    Boolean enableSecurity = source.getEnableSecurity();
    cluster.setSecure(enableSecurity == null ? Boolean.FALSE : enableSecurity);
    convertKnox(source, cluster);
    if (source.getKerberos() != null) {
        KerberosConfig kerberosConfig = getConversionService().convert(source.getKerberos(), KerberosConfig.class);
        cluster.setKerberosConfig(kerberosConfig);
    }
    cluster.setConfigStrategy(source.getConfigStrategy());
    cluster.setEmailTo(source.getEmailTo());
    FileSystemBase fileSystem = source.getFileSystem();
    cluster.setCloudbreakAmbariPassword(PasswordUtil.generatePassword());
    cluster.setCloudbreakAmbariUser("cloudbreak");
    convertAttributes(source, cluster);
    if (fileSystem != null) {
        cluster.setFileSystem(getConversionService().convert(fileSystem, FileSystem.class));
    }
    Map<String, String> inputs = source.getBlueprintInputs() == null ? Collections.emptyMap() : convertBlueprintInputJsons(source.getBlueprintInputs());
    try {
        cluster.setBlueprintInputs(new Json(inputs));
        if (source.getBlueprintCustomProperties() != null) {
            cluster.setBlueprintCustomProperties(source.getBlueprintCustomProperties());
        } else {
            cluster.setBlueprintCustomProperties(null);
        }
    } catch (JsonProcessingException ignored) {
        cluster.setBlueprintInputs(null);
    }
    try {
        Json json = new Json(convertContainerConfigs(source.getCustomContainer()));
        cluster.setCustomContainerDefinition(json);
    } catch (JsonProcessingException ignored) {
        cluster.setCustomContainerDefinition(null);
    }
    cluster.setAmbariSecurityMasterKey(source.getAmbariSecurityMasterKey());
    return cluster;
}
Also used : FileSystemBase(com.sequenceiq.cloudbreak.api.model.FileSystemBase) KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) GatewayJson(com.sequenceiq.cloudbreak.api.model.GatewayJson) Json(com.sequenceiq.cloudbreak.domain.json.Json) BlueprintInputJson(com.sequenceiq.cloudbreak.api.model.BlueprintInputJson) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)7 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)5 FileSystemConfigurationView (com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView)2 KerberosConfig (com.sequenceiq.cloudbreak.domain.KerberosConfig)2 IOException (java.io.IOException)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 BlueprintInputJson (com.sequenceiq.cloudbreak.api.model.BlueprintInputJson)1 FileSystemBase (com.sequenceiq.cloudbreak.api.model.FileSystemBase)1 FileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)1 FileSystemRequest (com.sequenceiq.cloudbreak.api.model.FileSystemRequest)1 GatewayJson (com.sequenceiq.cloudbreak.api.model.GatewayJson)1 KerberosRequest (com.sequenceiq.cloudbreak.api.model.KerberosRequest)1 BlueprintProcessingException (com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException)1 HdfConfigs (com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs)1 BlueprintView (com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView)1 BlueprintStackInfo (com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo)1 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)1 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)1 LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)1 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)1