}
String cmd = command.replaceAll("@DRYRUN@", "-d");
if (cmd.contains("@DRYRUNCONF@")) {
cmd = cmd.replaceAll("@DRYRUNCONF@", "-c /var/lib/drbd/drbd.conf-lcmc-test");
}
final SshOutput output = host.captureCommand(new ExecCommandConfig().command(cmd)
.silentCommand()
.silentOutput());
M_DRBD_TEST_WRITELOCK.lock();
try {
if (drbdtestOutput == null) {
drbdtestOutput = output.getOutput();
} else {
drbdtestOutput += output.getOutput();
}
} finally {
M_DRBD_TEST_WRITELOCK.unlock();
}
return output;
} else {
String cmd;
if (command.contains("@DRYRUN@")) {
cmd = command.replaceAll("@DRYRUN@", "");
} else {
cmd = command;
}
cmd = cmd.replaceAll("@DRYRUNCONF@", "");
final String progressText = Tools.getString("DRBD.ExecutingCommand")
+ ' '
+ cmd.replaceAll(DistResource.SUDO, " ")
+ "...";
return host.captureCommandProgressIndicator(progressText,
new ExecCommandConfig().command(cmd)
.execCallback(execCallback)
.commandVisible(outputVisible)
.outputVisible(outputVisible));
}
}