Commit 003c1dc4 authored by Leigh Stoller's avatar Leigh Stoller

Allow lookup of deleted images/osinfos when looking up by numeric id and

version number.
parent 04c35b0b
......@@ -122,7 +122,7 @@ sub Lookup($$;$$)
"left join image_versions as v on ".
" v.imageid=i.imageid ".
"where i.pid='$1' and i.imagename='$2' and ".
" v.version='$3' and v.deleted is null");
" v.version='$3'");
return undef
if (!$result || !$result->numrows);
......@@ -161,13 +161,15 @@ sub Lookup($$;$$)
}
elsif (!defined($arg3)) {
if ($arg1 =~ /^\d+$/ && $arg2 =~ /^\d+$/) {
#
# This will get deleted images, but that is okay.
#
my $result =
DBQueryWarn("select i.*,v.*,i.uuid as image_uuid ".
" from images as i ".
"left join image_versions as v on ".
" from image_versions as v ".
"left join images as i on ".
" v.imageid=i.imageid ".
"where i.imageid='$arg1' and v.version='$arg2' ".
" and v.deleted is null");
"where v.imageid='$arg1' and v.version='$arg2'");
return undef
if (! $result || !$result->numrows);
......@@ -209,7 +211,7 @@ sub Lookup($$;$$)
"left join image_versions as v on ".
" v.imageid=i.imageid ".
"where i.pid='$arg1' and i.imagename='$arg2' and ".
" v.version='$arg3' and v.deleted is null");
" v.version='$arg3'");
return undef
if (!$result || !$result->numrows);
......
......@@ -184,11 +184,12 @@ sub Lookup($$;$$)
}
elsif (!defined($arg3)) {
if ($arg1 =~ /^\d+$/ && $arg2 =~ /^\d+$/) {
#
# This will get deleted OSs, but that is okay.
#
my $result =
DBQueryWarn("select v.* from os_info as o ".
"left join os_info_versions as v on ".
" v.osid=o.osid ".
"where o.osid='$arg1' and v.vers='$arg2'");
DBQueryWarn("select v.* from os_info_versions as v ".
"where v.osid='$arg1' and v.vers='$arg2'");
return undef
if (! $result || !$result->numrows);
......
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