Commit 8fe5da7e authored by Leigh B Stoller's avatar Leigh B Stoller

Minor fix to previous revision wrt apt_instance lookup.

parent b1af3387
......@@ -179,6 +179,24 @@ sub Stringify($)
return "[APT_Instance: $uuid]";
}
sub LookupBySlice($$)
{
my ($class, $slice_uuid) = @_;
if ($slice_uuid !~ /^\w+\-\w+\-\w+\-\w+\-\w+$/) {
return undef
}
my $query_result =
DBQueryWarn("select uuid from apt_instances ".
"where slice_uuid='$slice_uuid'");
return undef
if (!$query_result || !$query_result->numrows);
my ($uuid) = $query_result->fetchrow_array();
return APT_Instance->Lookup($uuid);
}
#
# Perform some updates ...
#
......
......@@ -359,7 +359,7 @@ sub ExpireSlices()
# Experimental
if ($MAINSITE) {
my $instance = APT_Instance->Lookup($slice_uuid);
my $instance = APT_Instance->LookupBySlice($slice_uuid);
if (defined($instance)) {
$instance->Delete();
}
......
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