use of com.cloudera.api.swagger.RoleConfigGroupsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerClientActions method checkCmHdfsDatanodeRoleConfigGroups.
public DistroXTestDto checkCmHdfsDatanodeRoleConfigGroups(DistroXTestDto testDto, String user, String password, Set<String> mountPoints) {
String serverIp = testDto.getResponse().getCluster().getServerIp();
ApiClient apiClient = getCmApiClientWithTimeoutDisabled(serverIp, testDto.getName(), V_43, user, password);
// CHECKSTYLE:OFF
RoleConfigGroupsResourceApi roleConfigGroupsResourceApi = new RoleConfigGroupsResourceApi(apiClient);
// CHECKSTYLE:ON
try {
ApiConfigList hdfsConfigs = roleConfigGroupsResourceApi.readConfig(testDto.getName(), "hdfs-DATANODE-BASE", "hdfs", "summary");
hdfsConfigs.getItems().forEach(config -> {
String hdfsConfigName = config.getName();
String mappingsFromHdfsConfig = config.getValue();
if ("dfs_data_dir_list".equalsIgnoreCase(hdfsConfigName)) {
if (mountPoints.stream().anyMatch(mappingsFromHdfsConfig::startsWith)) {
LOGGER.error("{} contains ephemeral volume mapping '{}'!", hdfsConfigName, mappingsFromHdfsConfig);
throw new TestFailException(String.format("%s contains ephemeral volume mapping '%s'!", hdfsConfigName, mappingsFromHdfsConfig));
} else {
Log.log(LOGGER, format(" '%s' does not contain the ephemeral mapping '%s', as expected. ", hdfsConfigName, mappingsFromHdfsConfig));
}
}
});
if (hdfsConfigs.getItems().isEmpty()) {
LOGGER.error("Datanode mappings are NOT exist!");
throw new TestFailException("Datanode mappings are NOT exist!");
}
} catch (ApiException e) {
LOGGER.error("Exception when calling RoleConfigGroupsResourceApi#readConfig. Response: {}", e.getResponseBody(), e);
String message = format("Exception when calling RoleConfigGroupsResourceApi#readConfig at %s. Response: %s", apiClient.getBasePath(), e.getResponseBody());
throw new TestFailException(message, e);
} catch (Exception e) {
LOGGER.error("Can't read config at: '{}'!", apiClient.getBasePath());
throw new TestFailException("Can't read config at: " + apiClient.getBasePath(), e);
}
return testDto;
}
Aggregations