Commit ebe4652e authored by Leigh Stoller's avatar Leigh Stoller

Couple of additional checks to make sure we do not create a profile

with no rspec, nor try to start an experiment with no rspec.
parent 63c10c6d
......@@ -346,9 +346,20 @@ $version = $profile->version();
#
if (exists($xmlparse->{'attribute'}->{"rspec"})) {
$rspecstr = $xmlparse->{'attribute'}->{"rspec"}->{'value'};
# Trim()
$rspecstr =~ s/^\s+|\s+$//g;
if ($rspecstr eq "") {
UserError("Not a valid rspec");
}
}
else {
$rspecstr = $profile->CheckFirewall(!$localuser);
$rspecstr = $profile->rspec();
# Trim()
$rspecstr =~ s/^\s+|\s+$//g;
if ($rspecstr eq "") {
UserError("Profile does not have a valid rspec");
}
$rspecstr = $profile->CheckFirewall(!$localuser);
}
#
# Optional rspec and/or script, as for a repo-based profile.
......@@ -653,13 +664,11 @@ if ($localuser) {
$emulab_user, $project));
# Hack for Kobus' class, generalize someday.
if (0) {
if ($pid eq "CS4480-2018") {
my $termination = str2time("2018-05-02");
# convert to hours till then
$duration = int(($termination - time()) / 3600);
}
}
}
elsif (!$localuser) {
if (defined($sshkey)) { #
......
......@@ -129,12 +129,16 @@ function Do_Create()
if (! TBvalid_rspec($formfields["profile_rspec"])) {
$errors["profile_rspec"] = TBFieldErrorString();
}
elseif (trim($formfields["profile_rspec"]) == "") {
$errors["profile_rspec"] = "no rspec provided";
}
else {
$rspec = $formfields["profile_rspec"];
}
}
if (isset($formfields["profile_script"]) &&
$formfields["profile_script"] != "") {
$formfields["profile_script"] != "" &&
trim($formfields["profile_script"]) != "") {
$script = $formfields["profile_script"];
}
if (isset($formfields["portal_converted"]) &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment