use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ImageService method addCmRepo.
private void addCmRepo(Stack stack, Set<Component> components, com.sequenceiq.cloudbreak.cloud.model.catalog.Image catalogBasedImage) throws CloudbreakImageCatalogException {
if (catalogBasedImage.getStackDetails() != null) {
ImageStackDetails stackDetails = catalogBasedImage.getStackDetails();
StackType stackType = determineStackType(stackDetails);
ClouderaManagerRepo clouderaManagerRepo = getClouderaManagerRepo(catalogBasedImage, stackType);
components.add(new Component(CM_REPO_DETAILS, CM_REPO_DETAILS.name(), new Json(clouderaManagerRepo), stack));
} else {
LOGGER.debug("There are no stackDetails for stack {}, cannot determine CM repo version.", stack.getName());
}
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method tagHostsWithHostTemplateName.
private void tagHostsWithHostTemplateName() throws ApiException, CloudbreakException {
ClouderaManagerRepo clouderaManagerRepoDetails = clusterComponentProvider.getClouderaManagerRepoDetails(stack.getCluster().getId());
if (isVersionNewerOrEqualThanLimited(clouderaManagerRepoDetails::getVersion, CLOUDERAMANAGER_VERSION_7_6_0)) {
LOGGER.info("Tagging hosts after runtime upgrade.");
ApiClient v46Client = buildv46ApiClient();
HostsResourceApi hostsResourceApi = clouderaManagerApiFactory.getHostsResourceApi(v46Client);
Set<String> hostnamesFromCM = fetchHostNamesFromCm(v46Client);
startAsyncTagCalls(hostsResourceApi, hostnamesFromCM);
} else {
LOGGER.info("Skipping host tagging. Cloudera Manager version needs to be equal or higher, than 7.6.0. Current version: [{}]", clouderaManagerRepoDetails.getVersion());
}
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method callPostClouderaRuntimeUpgradeCommandIfCMIsNewerThan751.
private void callPostClouderaRuntimeUpgradeCommandIfCMIsNewerThan751(ClustersResourceApi clustersResourceApi) throws ApiException, CloudbreakException {
ClouderaManagerRepo clouderaManagerRepo = clusterComponentConfigProvider.getClouderaManagerRepoDetails(stack.getCluster().getId());
String currentCMVersion = clouderaManagerRepo.getVersion();
Versioned baseCMVersion = CLOUDERAMANAGER_VERSION_7_5_1;
if (isVersionNewerOrEqualThanLimited(currentCMVersion, baseCMVersion)) {
LOGGER.debug("Cloudera Manager version {} is newer than {} hence calling post runtime upgrade command using /v45 API", currentCMVersion, baseCMVersion.getVersion());
eventService.fireCloudbreakEvent(stack.getId(), UPDATE_IN_PROGRESS.name(), ResourceEvent.CLUSTER_UPGRADE_START_POST_UPGRADE);
waitForRestartCommandIfThereIsAny(clustersResourceApi);
Cluster cluster = stack.getCluster();
String user = cluster.getCloudbreakAmbariUser();
String password = cluster.getCloudbreakAmbariPassword();
try {
ApiClient v45Client = clouderaManagerApiClientProvider.getV45Client(stack.getGatewayPort(), user, password, clientConfig);
ClustersResourceApi clustersResourceV45Api = clouderaManagerApiFactory.getClustersResourceApi(v45Client);
clouderaManagerUpgradeService.callPostRuntimeUpgradeCommand(clustersResourceV45Api, stack, v45Client);
} catch (ClouderaManagerClientInitException e) {
LOGGER.info("Couldn't build CM v45 client", e);
throw new CloudbreakException(e);
}
} else {
LOGGER.debug("Cloudera Manager version {} is older than {} hence NOT calling post runtime upgrade command", currentCMVersion, baseCMVersion.getVersion());
}
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ClouderaManagerSetupService method addNoProxyHosts.
private void addNoProxyHosts(ProxyConfig proxyConfig, ApiConfigList proxyConfigList) {
if (StringUtils.isNotBlank(proxyConfig.getNoProxyHosts())) {
Cluster cluster = stack.getCluster();
ClouderaManagerRepo clouderaManagerRepoDetails = clusterComponentProvider.getClouderaManagerRepoDetails(cluster.getId());
if (isVersionNewerOrEqualThanLimited(clouderaManagerRepoDetails::getVersion, CLOUDERAMANAGER_VERSION_7_6_0)) {
proxyConfigList.addItemsItem(new ApiConfig().name("parcel_no_proxy_list").value(proxyConfig.getNoProxyHosts()));
}
}
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class ClouderaManagerSetupService method prepareTemplate.
@Override
public String prepareTemplate(Map<HostGroup, List<InstanceMetaData>> instanceMetaDataByHostGroup, TemplatePreparationObject templatePreparationObject, String sdxContext, String sdxCrn, KerberosConfig kerberosConfig) {
Long clusterId = stack.getCluster().getId();
try {
Set<InstanceMetaData> instances = instanceMetaDataByHostGroup.values().stream().flatMap(Collection::stream).collect(Collectors.toSet());
waitForHosts(instances);
String sdxContextName = Optional.ofNullable(sdxContext).map(this::setupRemoteDataContext).orElse(null);
ClouderaManagerRepo clouderaManagerRepoDetails = clusterComponentProvider.getClouderaManagerRepoDetails(clusterId);
ApiClusterTemplate apiClusterTemplate = getCmTemplate(templatePreparationObject, sdxContextName, instanceMetaDataByHostGroup, clouderaManagerRepoDetails, clusterId);
return getExtendedBlueprintText(apiClusterTemplate);
} catch (CancellationException cancellationException) {
throw cancellationException;
} catch (Exception e) {
throw mapException(e);
}
}
Aggregations