use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerCommissioner method abortRecommissionWithWarnMessage.
private void abortRecommissionWithWarnMessage(ApiCommand apiCommand, ApiClient client, String warningMessage) throws ApiException {
LOGGER.warn(warningMessage, apiCommand.getId());
CommandsResourceApi commandsResourceApi = clouderaManagerApiFactory.getCommandsResourceApi(client);
commandsResourceApi.abortCommand(apiCommand.getId());
}
use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerCommandsService method retryApiCommand.
public ApiCommand retryApiCommand(ApiClient client, BigDecimal commandId) throws ApiException {
CommandsResourceApi commandsResourceApi = clouderaManagerApiFactory.getCommandsResourceApi(client);
ApiCommand retryApiCommand = commandsResourceApi.retry(commandId);
LOGGER.debug("Retry Api command by id {} result is {}", commandId, retryApiCommand);
return retryApiCommand;
}
use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class AbstractClouderaManagerCommandListCheckerTask method doStatusCheck.
protected boolean doStatusCheck(T pollerObject) throws ApiException {
CommandsResourceApi commandsResourceApi = clouderaManagerApiPojoFactory.getCommandsResourceApi(pollerObject.getApiClient());
List<ApiCommand> apiCommands = collectApiCommands(pollerObject, commandsResourceApi);
boolean allCommandsFinished = apiCommands.stream().noneMatch(ApiCommand::getActive);
if (allCommandsFinished) {
validateApiCommandResults(apiCommands, commandsResourceApi);
return true;
} else {
return false;
}
}
use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerRangerUtil method getApiCommand.
public ApiCommand getApiCommand(String stackCrn, long commandId) throws ApiException {
ApiClient client = clouderaManagerProxiedClientFactory.getProxiedClouderaManagerClient(stackCrn);
CommandsResourceApi commandsResourceApi = clouderaManagerApiFactory.getCommandsResourceApi(client);
return commandsResourceApi.readCommand(BigDecimal.valueOf(commandId));
}
use of com.cloudera.api.swagger.CommandsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerCommissionerTest method testRecommissionNodesTimeout.
@Test
public void testRecommissionNodesTimeout() throws ApiException {
Set<String> hostNames = createHostnames(3);
ApiHostList apiHostList = createGoodHealthApiHostList(hostNames);
mockListClusterHosts(apiHostList);
Map<String, InstanceMetaData> hostsToDecommission;
Set<InstanceMetaData> instanceMetaDataSet = createRunningInstanceMetadata(hostNames);
Map<String, InstanceMetaData> hostsToCommission = instanceMetaDataSet.stream().collect(Collectors.toMap(InstanceMetaData::getDiscoveryFQDN, e -> e));
// TODO CB-15132: What are the other PollingResults that CM can return. How about entities like FAILURE?.
// Is an explicit check for SUCCESS required?
mockCommissionAndExitMaintenanceMode(new ExtendedPollingResult.ExtendedPollingResultBuilder().timeout().build());
mockAbortCommission();
assertThrows(CloudbreakServiceException.class, () -> underTest.recommissionNodes(getStack(), hostsToCommission, client));
verify(commandsResourceApi).abortCommand(eq(BigDecimal.valueOf(1)));
}
Aggregations