Commit e1015373 authored by Leigh B Stoller's avatar Leigh B Stoller

Use a feature for enabling profile/image deletion, currently enabled

for testbed,tbres,utahstud.
parent 1ebe31f8
...@@ -602,10 +602,13 @@ if (defined($instance)) { ...@@ -602,10 +602,13 @@ if (defined($instance)) {
else { else {
$newimage = $iwebtask->image_url(); $newimage = $iwebtask->image_url();
} }
if (!defined($newimage) || if (!defined($newimage)) {
$profile->UpdateDiskImage($node_id, $newimage, 0)) { fatal("Did not get an image for $node_id");
$profile->Delete(1); $profile->Delete(1);
fatal("Could not update image URN in rspec"); }
if ($profile->UpdateDiskImage($node_id, $newimage, 0)) {
$profile->Delete(1);
fatal("Could not update image in rspec for $node_id; $newimage;");
} }
# Tell web interface cloning has started. # Tell web interface cloning has started.
$pwebtask->cloning(1); $pwebtask->cloning(1);
...@@ -757,12 +760,11 @@ sub escapeshellarg($) ...@@ -757,12 +760,11 @@ sub escapeshellarg($)
# #
sub DeleteProfile() sub DeleteProfile()
{ {
my $optlist = "akfnm"; my $optlist = "akfn";
my $all = 0; my $all = 0;
my $keepimages = 0; my $keepimages = 0;
my $force = 0; my $force = 0;
my $impotent = 0; my $impotent = 0;
my $mereuser = 0;
my $errmsg; my $errmsg;
my %images; my %images;
my %snapnames = (); my %snapnames = ();
...@@ -784,9 +786,6 @@ sub DeleteProfile() ...@@ -784,9 +786,6 @@ sub DeleteProfile()
if (defined($options{"n"})) { if (defined($options{"n"})) {
$impotent = 1; $impotent = 1;
} }
if (defined($options{"m"})) {
$mereuser = 1;
}
usage() usage()
if (!@ARGV); if (!@ARGV);
...@@ -802,8 +801,15 @@ sub DeleteProfile() ...@@ -802,8 +801,15 @@ sub DeleteProfile()
$errmsg = "Not allowed to delete this profile (version)"; $errmsg = "Not allowed to delete this profile (version)";
goto uerror; goto uerror;
} }
# For now, mere users do not see new image deletion stuff. # For now, mere users do not see new image deletion stuff unless
$keepimages = 1 if ($mereuser); # feature enabled.
if (! ($this_user->admin() || $this_user->stud())) {
my $project = Project->Lookup($profile->pid_idx());
if (! EmulabFeatures->FeatureEnabled("APT_ImageDeletion",
$this_user, $project)) {
$keepimages = 1;
}
}
# If deleting the only version of a profile, then force $all. # If deleting the only version of a profile, then force $all.
if ($profile->VersionCount() == 1) { if ($profile->VersionCount() == 1) {
...@@ -1032,6 +1038,7 @@ sub DeleteProfile() ...@@ -1032,6 +1038,7 @@ sub DeleteProfile()
} }
} }
if ($impotent) { if ($impotent) {
print "Not deleting profile, as requested.\n";
return 0; return 0;
} }
if ($all || $profile->VersionCount() == 1) { if ($all || $profile->VersionCount() == 1) {
......
...@@ -158,10 +158,6 @@ function Do_DeleteProfile() ...@@ -158,10 +158,6 @@ function Do_DeleteProfile()
$opt .= "-k "; $opt .= "-k ";
} }
} }
# Mere users do not see new path.
if (! ($this_user->admin() || $this_user->stud())) {
$opt .= "-m ";
}
$webtask = WebTask::CreateAnonymous(); $webtask = WebTask::CreateAnonymous();
if (!$webtask) { if (!$webtask) {
SPITAJAX_ERROR(-1, "Internal webtask Error"); SPITAJAX_ERROR(-1, "Internal webtask Error");
......
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