if (sshfile == null) {
this.print.errln("WARNING: no SSH public key is configured");
}
if (this.args.getHistoryDirectory() == null) {
throw new ParameterProblem("Running requires '" +
Opts.HISTORY_DIR_OPT_STRING + "'");
}
this._checkHistoryDirectory("Running");
if (!this.args.isDurationMinutesConfigured()) {
throw new ParameterProblem("Running requires '" +
Opts.HOURS_OPT_STRING + "'");
}
this.print.debugln("Checking on repository URL for running " +
"because we are going to derive propagation string " +
"for the client");
this.repoUtil.paramterCheck(this.args, Opts.RUN_OPT_STRING);
final String newname = this.args.getNewname();
if (newname != null) {
this.print.debugln(
"run called with newname '" + newname + "'");
try {
this.newUnpropTargetURL =
this.repoUtil.getDerivedImageURL(newname);
} catch (Exception e) {
throw new ParameterProblem("Problem with run's newname '" +
newname + "': " + e.getMessage(), e);
}
}
if (sshfile != null) {
sshfile = CloudClientUtil.expandSshPath(sshfile);
final File f = new File(sshfile);
sshfile = f.getAbsolutePath();
this.args.setSshfile(sshfile);
this.print.debugln("Examining '" + sshfile + "'");
if (!CloudClientUtil.fileExistsAndReadable(sshfile)) {
throw new ParameterProblem("SSH public key file does not " +
"exist or is not readable: '" + sshfile + "'");
}
this.print.debugln("Exists and readable: '" + sshfile + "'");
}
if (this.args.getKernel() != null) {
final String kernel = this.args.getKernel().trim();
if (kernel.length() == 0) {
throw new ParameterProblem("empty kernel string?");
}
if (kernel.indexOf('/') >= 0) {
throw new ParameterProblem("kernel may not contain any /");
}
if (kernel.indexOf("..") >= 0) {
throw new ParameterProblem("kernel may not contain any '..'");
}
// already-propagated kernel is implied
try {
this.kernelURI = new URI("file://" + kernel);
} catch (URI.MalformedURIException e) {
throw new ParameterProblem(e.getMessage(), e);
}
}
}