in src/main/java/co/elastic/support/diagnostics/DiagnosticInputs.java [158:238]
public boolean runInteractive(TextIOManager textIOManager) {
bypassDiagVerify = textIOManager.standardBooleanReader
.withDefaultValue(bypassDiagVerify)
.read(SystemProperties.lineSeparator + bypassDiagVerifyDescription);
diagType = textIOManager.textIO.newStringInputReader()
.withNumberedPossibleValues(typeEntries)
.withDefaultValue(typeEntries[0])
.read(SystemProperties.lineSeparator + typeDescription)
.toLowerCase();
diagType = diagType.substring(0, diagType.indexOf(" - "));
setDefaultPortForDiagType(diagType);
// We'll do this for any Elastic or Logstash submit
runHttpInteractive(textIOManager);
if (diagType.contains("remote")) {
logger.info(Constants.CONSOLE, remoteAccessMessage);
String remoteUserTxt = "User account to be used for running system commands and obtaining logs." +
SystemProperties.lineSeparator
+ "This account must have sufficient authority to run the commands and access the logs.";
remoteUser = textIOManager.textIO.newStringInputReader()
.withInputTrimming(true)
.withValueChecker((String val, String propname) -> validateRemoteUser(val))
.read(SystemProperties.lineSeparator + remoteUserTxt);
isSudo = textIOManager.textIO.newBooleanInputReader()
.withDefaultValue(isSudo)
.read(SystemProperties.lineSeparator + sudoDescription);
boolean useKeyfile = textIOManager.textIO.newBooleanInputReader()
.withDefaultValue(false)
.read(SystemProperties.lineSeparator + "Use a keyfile for authentication?");
if (useKeyfile) {
keyfile = textIOManager.standardFileReader
.read(SystemProperties.lineSeparator + sshKeyFileDescription);
boolean checkMe = textIOManager.standardBooleanReader
.read("Is the keyfile password protected?");
if (checkMe) {
keyfilePassword = textIOManager.standardPasswordReader
.read(SystemProperties.lineSeparator + sshKeyFIlePassphraseDescription);
}
if (isSudo) {
checkMe = textIOManager.standardBooleanReader
.read("Password required for sudo challenge?");
if (checkMe) {
remotePassword = textIOManager.standardPasswordReader
.read(SystemProperties.lineSeparator + "Enter the password for remote sudo.");
}
}
} else {
remotePassword = textIOManager.standardPasswordReader
.read(SystemProperties.lineSeparator + remotePasswordDescription);
}
remotePort = textIOManager.textIO.newIntInputReader()
.withDefaultValue(remotePort)
.withValueChecker((Integer val, String propname) -> validatePort(val))
.read(SystemProperties.lineSeparator + remotePortDescription);
trustRemote = textIOManager.standardBooleanReader
.withDefaultValue(trustRemote)
.read(SystemProperties.lineSeparator + trustRemoteDescription);
if (!trustRemote) {
knownHostsFile = textIOManager.standardFileReader
.read(SystemProperties.lineSeparator + knownHostsDescription);
}
}
runOutputDirInteractive(textIOManager);
return true;
}