use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationCheckerTest method checkStatusWithMultiLevelMessage.
@Test
void checkStatusWithMultiLevelMessage() throws ApiException {
ApiCommand addRepositoriesCmd = addReposCmd();
ApiCommand deployParcelsCmd = deployParcelsCmd();
ApiCommand firstRunCmd = firstRunCmd().success(Boolean.FALSE).resultMessage("Failed to perform First Run of services.");
ApiCommand templateInstallCmd = templateInstallCmd(addRepositoriesCmd, deployParcelsCmd, firstRunCmd).resultMessage("Failed to import cluster template");
expectReadCommandForFailedCommands(templateInstallCmd);
ClouderaManagerOperationFailedException ex = assertThrowsExact(ClouderaManagerOperationFailedException.class, () -> underTest.checkStatus(pollerObject));
String expected = expectMessageForCommands(firstRunCmd);
assertEquals(expected, ex.getMessage());
}
use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationCheckerTest method checkStatusWithTopLevelMessage.
@Test
void checkStatusWithTopLevelMessage() throws ApiException {
ApiCommand addRepositoriesCmd = addReposCmd();
ApiCommand deployParcelsCmd = deployParcelsCmd();
ApiCommand templateInstallCmd = templateInstallCmd(addRepositoriesCmd, deployParcelsCmd).resultMessage("IllegalArgumentException: Unknown configuration attribute 'process_autorestart_enabled'.");
expectReadCommandForFailedCommands(templateInstallCmd);
ClouderaManagerOperationFailedException ex = assertThrowsExact(ClouderaManagerOperationFailedException.class, () -> underTest.checkStatus(pollerObject));
String expected = expectMessageForCommands(templateInstallCmd);
assertEquals(expected, ex.getMessage());
}
use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationChecker method handleTimeout.
@Override
public void handleTimeout(ClouderaManagerCommandPollerObject pollerObject) {
String msg = "Installation of CDP with Cloudera Manager has timed out (command id: " + pollerObject.getId() + ").";
try {
CommandsResourceApi commandsResourceApi = clouderaManagerApiPojoFactory.getCommandsResourceApi(pollerObject.getApiClient());
ApiCommand apiCommand = commandsResourceApi.readCommand(pollerObject.getId());
fail(msg, apiCommand, commandsResourceApi, pollerObject.getStack().getType());
} catch (ApiException e) {
LOGGER.info("Cloudera Manager had run into a timeout, and we were unable to determine the failure reason", e);
}
throw new ClouderaManagerOperationFailedException(msg);
}
use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationChecker method fail.
private void fail(String messagePrefix, ApiCommand apiCommand, CommandsResourceApi commandsResourceApi, StackType stackType) {
List<CommandDetails> failedCommands = ClouderaManagerCommandUtil.getFailedOrActiveCommands(apiCommand, commandsResourceApi);
String msg = messagePrefix + "Installation of CDP with Cloudera Manager has failed. " + CommandDetailsFormatter.formatFailedCommands(failedCommands);
LOGGER.debug("Top level command {}. Failed or active commands: {}", CommandDetails.fromApiCommand(apiCommand), failedCommands);
if (stackType == StackType.DATALAKE) {
for (CommandDetails failedCommand : failedCommands) {
// has no added value, therefore we are just checking whether AuditDir related commands are failing or not.
if (CLOUD_STORAGE_RELATED_COMMANDS.contains(failedCommand.getName()) && CommandDetails.CommandStatus.FAILED == failedCommand.getCommandStatus()) {
throw new CloudStorageConfigurationFailedException(msg);
}
}
}
throw new ClouderaManagerOperationFailedException(msg);
}
use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class AbstractClouderaManagerCommandCheckerTask method doStatusCheck.
protected boolean doStatusCheck(T pollerObject) throws ApiException {
CommandsResourceApi commandsResourceApi = clouderaManagerApiPojoFactory.getCommandsResourceApi(pollerObject.getApiClient());
ApiCommand apiCommand = commandsResourceApi.readCommand(pollerObject.getId());
if (apiCommand.getActive()) {
LOGGER.debug("Command [{}] with id [{}] is active, so it hasn't finished yet", getCommandName(), pollerObject.getId());
return false;
} else if (apiCommand.getSuccess()) {
return true;
} else {
List<CommandDetails> commandDetails = ClouderaManagerCommandUtil.getFailedOrActiveCommands(apiCommand, commandsResourceApi);
String message = CommandDetailsFormatter.formatFailedCommands(commandDetails);
LOGGER.debug("Top level command {}. Failed or active commands: {}", CommandDetails.fromApiCommand(apiCommand), commandDetails);
throw new ClouderaManagerOperationFailedException(message);
}
}
Aggregations