use of com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException in project cloudbreak by hortonworks.
the class ClouderaManagerSetupService method waitForHostsHealthy.
@Override
public void waitForHostsHealthy(Set<InstanceMetaData> hostsInCluster) throws ClusterClientInitException {
Cluster cluster = stack.getCluster();
String user = cluster.getCloudbreakAmbariUser();
String password = cluster.getCloudbreakAmbariPassword();
ApiClient client;
try {
client = clouderaManagerApiClientProvider.getV31Client(stack.getGatewayPort(), user, password, clientConfig);
} catch (ClouderaManagerClientInitException e) {
throw new ClusterClientInitException(e);
}
clouderaManagerPollingServiceProvider.startPollingCmHostStatusHealthy(stack, client, hostsInCluster.stream().map(x -> x.getDiscoveryFQDN()).collect(Collectors.toUnmodifiableSet()));
}
use of com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException in project cloudbreak by hortonworks.
the class ClouderaManagerSetupService method setupRemoteDataContext.
@Override
public String setupRemoteDataContext(String sdxContext) {
Cluster cluster = stack.getCluster();
String user = cluster.getCloudbreakAmbariUser();
String password = cluster.getCloudbreakAmbariPassword();
try {
ApiClient rootClient = clouderaManagerApiClientProvider.getRootClient(stack.getGatewayPort(), user, password, clientConfig);
CdpResourceApi cdpResourceApi = clouderaManagerApiFactory.getCdpResourceApi(rootClient);
ApiRemoteDataContext apiRemoteDataContext = JsonUtil.readValue(sdxContext, ApiRemoteDataContext.class);
LOGGER.debug("Posting remote context to workload. EndpointId: {}", apiRemoteDataContext.getEndPointId());
return cdpResourceApi.postRemoteContext(apiRemoteDataContext).getEndPointId();
} catch (ApiException | ClouderaManagerClientInitException e) {
LOGGER.info("Error while creating data context using: {}", sdxContext, e);
throw new ClouderaManagerOperationFailedException(String.format("Error while creating data context: %s", e.getMessage()), e);
} catch (IOException e) {
LOGGER.info("Failed to parse SDX context to CM API object.", e);
throw new ClouderaManagerOperationFailedException(String.format("Failed to parse SDX context to CM API object: %s", e.getMessage()), e);
}
}
use of com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException in project cloudbreak by hortonworks.
the class ClouderaManagerSetupService method getSdxContext.
@Override
public String getSdxContext() {
Cluster cluster = stack.getCluster();
String user = cluster.getCloudbreakAmbariUser();
String password = cluster.getCloudbreakAmbariPassword();
try {
ApiClient rootClient = clouderaManagerApiClientProvider.getRootClient(stack.getGatewayPort(), user, password, clientConfig);
CdpResourceApi cdpResourceApi = clouderaManagerApiFactory.getCdpResourceApi(rootClient);
LOGGER.info("Get remote context from Datalake cluster: {}", stack.getName());
ApiRemoteDataContext remoteDataContext = cdpResourceApi.getRemoteContextByCluster(stack.getName());
return JsonUtil.writeValueAsString(remoteDataContext);
} catch (ApiException | ClouderaManagerClientInitException e) {
LOGGER.error("Error while getting remote context of Datalake cluster: {}", stack.getName(), e);
throw new ClouderaManagerOperationFailedException("Error while getting remote context of Datalake cluster", e);
} catch (JsonProcessingException e) {
LOGGER.error("Failed to serialize remote context.", e);
throw new ClouderaManagerOperationFailedException("Failed to serialize remote context.", e);
}
}
use of com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException in project cloudbreak by hortonworks.
the class ClouderaManagerSetupService method initApiClient.
@PostConstruct
public void initApiClient() throws ClusterClientInitException {
Cluster cluster = stack.getCluster();
String user = cluster.getCloudbreakAmbariUser();
String password = cluster.getCloudbreakAmbariPassword();
try {
ClouderaManagerRepo clouderaManagerRepoDetails = clusterComponentProvider.getClouderaManagerRepoDetails(cluster.getId());
if (isVersionNewerOrEqualThanLimited(clouderaManagerRepoDetails::getVersion, CLOUDERAMANAGER_VERSION_7_1_0)) {
apiClient = clouderaManagerApiClientProvider.getV40Client(stack.getGatewayPort(), user, password, clientConfig);
} else {
apiClient = clouderaManagerApiClientProvider.getV31Client(stack.getGatewayPort(), user, password, clientConfig);
}
} catch (ClouderaManagerClientInitException e) {
throw new ClusterClientInitException(e);
}
}
use of com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException in project cloudbreak by hortonworks.
the class ClouderaManagerClusterCommissionService method initApiClient.
@PostConstruct
public void initApiClient() throws ClusterClientInitException {
Cluster cluster = stack.getCluster();
String user = cluster.getCloudbreakAmbariUser();
String password = cluster.getCloudbreakAmbariPassword();
try {
client = clouderaManagerApiClientProvider.getV31Client(stack.getGatewayPort(), user, password, clientConfig);
} catch (ClouderaManagerClientInitException e) {
throw new ClusterClientInitException(e);
}
}
Aggregations