Commit f2c283b6 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Bug fix for for profiles that use *only* the naked version.

parent 4d60b792
...@@ -42,9 +42,6 @@ my $debug = 0; ...@@ -42,9 +42,6 @@ my $debug = 0;
my $webtask_id; my $webtask_id;
my $webtask; my $webtask;
# For development.
my $usemydevtree = 0;
# #
# Configure variables # Configure variables
# #
...@@ -53,6 +50,10 @@ my $TBOPS = "@TBOPSEMAIL@"; ...@@ -53,6 +50,10 @@ my $TBOPS = "@TBOPSEMAIL@";
my $OURDOMAIN = "@OURDOMAIN@"; my $OURDOMAIN = "@OURDOMAIN@";
my $MYURN = "urn:publicid:IDN+${OURDOMAIN}+authority+cm"; my $MYURN = "urn:publicid:IDN+${OURDOMAIN}+authority+cm";
my $MANAGEPROFILE = "$TB/bin/manage_profile"; my $MANAGEPROFILE = "$TB/bin/manage_profile";
my $MAINSITE = @TBMAINSITE@;
# For development.
my $usemydevtree = ($MAINSITE ? 0 : 0);
# #
# Untaint the path # Untaint the path
...@@ -323,7 +324,8 @@ sub DoListImages() ...@@ -323,7 +324,8 @@ sub DoListImages()
# #
# And for each version of the image. # And for each version of the image.
# #
foreach my $image (@versions) { while (@versions) {
my $image = shift(@versions);
my $urn = $image->{'urn'}; my $urn = $image->{'urn'};
my @using = (); my @using = ();
$image->{'using'} = []; $image->{'using'} = [];
...@@ -334,11 +336,21 @@ sub DoListImages() ...@@ -334,11 +336,21 @@ sub DoListImages()
if (APT_Profile::ImageInfo::FindProfilesUsing($urn, \@using)); if (APT_Profile::ImageInfo::FindProfilesUsing($urn, \@using));
# #
# No references *currently* means we can delete the image. # No references *currently* means we can delete the image.
# #
if (!@using) { if (!@using) {
$image->{'candelete'} = 1; #
$ref->{'inactive'}++; # Unless the naked image is being used, and this is the
# highest numbered image.
#
if (@nakedusing && !@versions) {
$ref->{'candelete'} = 0;
$image->{'using'} = $ref->{'using'};
}
else {
$image->{'candelete'} = 1;
$ref->{'inactive'}++;
}
next; next;
} }
# Reset candelete to no for entire image. See above. # Reset candelete to no for entire image. See above.
...@@ -493,14 +505,14 @@ sub DoDeleteImage() ...@@ -493,14 +505,14 @@ sub DoDeleteImage()
my $vers = $version->version(); my $vers = $version->version();
my $uuid = $version->uuid(); my $uuid = $version->uuid();
print "Deleting version $vers\n"; print "Deleting version $uuid:$vers\n";
my $opt = ($impotent ? "-n" : ""); my $opt = ($impotent ? "-n" : "");
my $output = my $output =
emutil::ExecQuiet("$MANAGEPROFILE delete -k $opt $uuid"); emutil::ExecQuiet("$MANAGEPROFILE delete -k $opt $uuid");
print $output; print $output;
if ($?) { if ($?) {
fatal("Could not delete version $vers"); fatal("Could not delete version $uuid:$vers");
} }
} }
} }
......
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