Commit d88b614e authored by Jonathon Duerig's avatar Jonathon Duerig

Add URL tags to images in adverisement

parent fbb0d1a9
......@@ -33,6 +33,7 @@ use libdb qw(TBGetSiteVar);
use libadminctrl;
use libptop;
use EmulabFeatures;
use Image;
my @SAVEARGV = @ARGV;
......@@ -687,7 +688,7 @@ if (defined($pid)) {
# 2) To avoid information leaks, allowing projects to see each other's images
#
my $osidquery = "select distinct o.osid,oi.type,o.osname,o.pid,ov.OS,".
"ov.version,ov.description,ov.protogeni_export,ov.osfeatures ".
"ov.version,ov.description,ov.protogeni_export,ov.osfeatures,iv.metadata_url,i.imagename,i.pid ".
" from os_info as o ".
"left join os_info_versions as ov on ".
" ov.osid=o.osid and ov.vers=o.version ".
......@@ -711,10 +712,14 @@ if ($this_user) {
my $defaultosidquery =
"select distinct o.osid,t.type,o.osname,o.pid,ov.OS,".
"ov.version,ov.description,ov.protogeni_export,ov.osfeatures ".
"ov.version,ov.description,ov.protogeni_export,ov.osfeatures,iv.metadata_url,i.imagename,i.pid ".
" from os_info as o ".
"left join os_info_versions as ov on ".
" ov.osid=o.osid and ov.vers=o.version ".
"left join osidtoimageid as oi on o.osid = oi.osid ".
"left join images as i on oi.imageid = i.imageid ".
"left join image_versions as iv on ".
" iv.imageid=i.imageid and iv.version=i.version ".
"left join node_type_attributes as t ".
"on (o.osid=t.attrvalue) where t.attrkey='default_osid'";
......@@ -762,6 +767,7 @@ our %node_type_osids;
our %osid_node_types;
our %osid_subosids;
our %osid_name;
our %osid_url;
our %osid_pid;
our %osid_os;
our %osid_version;
......@@ -783,7 +789,7 @@ sub processOs
{
my $result = shift(@_);
while (my ($osid,$type,$osname,$ospid,$osos, $osversion,
$osdescription,$geni,$osfeatures) = $result->fetchrow()) {
$osdescription,$geni,$osfeatures,$remote_url,$imagename,$imagepid) = $result->fetchrow()) {
if ($osname eq "OPENVZ-STD") {
$openvzid = $osid;
}
......@@ -793,6 +799,12 @@ sub processOs
(defined($default) && $default eq $osid)) {
push(@{ $typemap{$type}->{'OSLIST'} }, $osid);
$osid_name{$osid} = $osname;
if (defined($remote_url)) {
$osid_url{$osid} = $remote_url;
} elsif (defined($imagename) && defined($imagepid)) {
$image = Image->Lookup("$imagepid,$imagename");
$osid_url{$osid} = $image->LocalURL();
}
$osid_pid{$osid} = $ospid;
$osid_os{$osid} = $osos;
$osid_version{$osid} = $osversion;
......@@ -2531,6 +2543,9 @@ sub print_osids
print "<disk_image ";
print "name=\"" . $urn . "\" ";
print "os=\"" . $osid_os{$os} . "\" ";
if (exists($osid_url{$os})) {
print "url=\"" . $osid_url{$os} . "\" ";
}
print "version=\"" . $osid_version{$os} . "\" ";
print "description=\"" . $osid_description{$os} . "\" ";
if (defined($default) && $os eq $default) {
......
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