mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Signed-off-by: John Burwell <meaux@cockamamy.net>
This commit is contained in:
commit
a661a11d76
@ -22,6 +22,10 @@ package com.cloud.utils.ssh;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
@ -196,6 +200,16 @@ public class SshHelper {
|
|||||||
|
|
||||||
String result = sbResult.toString();
|
String result = sbResult.toString();
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(result)) {
|
||||||
|
try {
|
||||||
|
result = IOUtils.toString(stdout, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
s_logger.error("Couldn't get content of input stream due to: " + e.getMessage());
|
||||||
|
return new Pair<Boolean, String>(false, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sess.getExitStatus() == null) {
|
if (sess.getExitStatus() == null) {
|
||||||
//Exit status is NOT available. Returning failure result.
|
//Exit status is NOT available. Returning failure result.
|
||||||
s_logger.error(String.format("SSH execution of command %s has no exit status set. Result output: %s", command, result));
|
s_logger.error(String.format("SSH execution of command %s has no exit status set. Result output: %s", command, result));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user