String sshkeypassphrase = map.getOne(PARAM_SSHKEYPASSPHRASE);
boolean installFlag = Boolean.parseBoolean(map.getOne(PARAM_INSTALL));
// We use the resolver to expand any system properties
if (!NetUtils.isPortStringValid(resolver.resolve(sshport))) {
throw new CommandValidationException(Strings.get(
"ssh.invalid.port", sshport));
}
int port = Integer.parseInt(resolver.resolve(sshport));
try {
// sshpassword and sshkeypassphrase may be password alias.
// Those aliases are handled by sshLauncher
String resolvedInstallDir = resolver.resolve(installdir);
sshL.validate(resolver.resolve(nodehost),
port,
resolver.resolve(sshuser),
sshpassword,
resolver.resolve(sshkeyfile),
sshkeypassphrase,
resolvedInstallDir,
// Landmark file to ensure valid GF install
LANDMARK_FILE,
logger);
}
catch (IOException e) {
String m1 = e.getMessage();
String m2 = "";
Throwable e2 = e.getCause();
if (e2 != null) {
m2 = e2.getMessage();
}
if (e instanceof FileNotFoundException) {
logger.warning(StringUtils.cat(": ", m1, m2, sshL.toString()));
if (!installFlag)
throw new CommandValidationException(StringUtils.cat(NL,
m1, m2));
}
else {
String msg = Strings.get("ssh.bad.connect", nodehost);
logger.warning(StringUtils.cat(": ", msg, m1, m2,
sshL.toString()));
throw new CommandValidationException(StringUtils.cat(NL,
msg, m1, m2));
}
}
}