if (StringUtils.ok(humanCommand)) {
msg3 = Strings.get("node.remote.tocomplete",
nodeHost, installDir, humanCommand);
}
NodeRunner nr = new NodeRunner(habitat, logger);
try {
int status = nr.runAdminCommandOnNode(node, output, waitForReaderThreads,
command, context);
if (status != 0) {
// Command ran, but didn't succeed. Log full information
msg2 = Strings.get("node.command.failed", nodeName,
nodeHost, output.toString().trim(), nr.getLastCommandRun());
logger.warning(StringUtils.cat(": ", msg1, msg2, msg3));
// Don't expose command name to user in case it is a hidden command
msg2 = Strings.get("node.command.failed.short", nodeName,
nodeHost, output.toString().trim());
}
else {
failure = false;
logger.info(output.toString().trim());
}
}
catch (SSHCommandExecutionException ec) {
msg2 = Strings.get("node.ssh.bad.connect",
nodeName, nodeHost, ec.getMessage());
// Log some extra info
String msg = Strings.get("node.command.failed.ssh.details",
nodeName, nodeHost, ec.getCommandRun(), ec.getMessage(),
ec.getSSHSettings());
logger.warning(StringUtils.cat(": ", msg1, msg, msg3));
}
catch (ProcessManagerException ex) {
msg2 = Strings.get("node.command.failed.local.details",
ex.getMessage(), nr.getLastCommandRun());
logger.warning(StringUtils.cat(": ", msg1, msg2, msg3));
// User message doesn't have command that was run
msg2 = Strings.get("node.command.failed.local.exception",
ex.getMessage());
}