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