use of org.apache.cloudstack.utils.process.ProcessResult in project cloudstack by apache.
the class IpmitoolWrapper method executeCommands.
public OutOfBandManagementDriverResponse executeCommands(final List<String> commands, final Duration timeOut) {
final ProcessResult result = RUNNER.executeCommands(commands, timeOut);
if (LOG.isTraceEnabled()) {
List<String> cleanedCommands = new ArrayList<String>();
int maskNextCommand = 0;
for (String command : commands) {
if (maskNextCommand > 0) {
cleanedCommands.add("**** ");
maskNextCommand--;
continue;
}
if (command.equalsIgnoreCase("-P")) {
maskNextCommand = 1;
} else if (command.toLowerCase().endsWith("password")) {
maskNextCommand = 2;
}
cleanedCommands.add(command);
}
LOG.trace("Executed ipmitool process with commands: " + StringUtils.join(cleanedCommands, ", ") + "\nIpmitool execution standard output: " + result.getStdOutput() + "\nIpmitool execution error output: " + result.getStdError());
}
return new OutOfBandManagementDriverResponse(result.getStdOutput(), result.getStdError(), result.isSuccess());
}
Aggregations