Commit 5043234d authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add method to lookup an aggregate by shortname instead of URN.

parent ef908699
...@@ -228,5 +228,28 @@ sub LookupForPortal($$) ...@@ -228,5 +228,28 @@ sub LookupForPortal($$)
return @result; return @result;
} }
#
# Lookup using the short auth name (emulab.net).
#
sub LookupByAuthName($$)
{
my ($class, $authname) = @_;
my @result = ();
if ($authname !~ /^[-\w\.]+$/) {
return undef;
}
my $query_result =
DBQueryWarn("select urn from apt_aggregates ".
"where urn like 'urn:publicid:IDN+${authname}+%'");
return undef
if (!$query_result);
return undef
if (!$query_result->numrows);
my ($aggregate_urn) = $query_result->fetchrow_array();
return Lookup($class, $aggregate_urn);
}
# _Always_ make sure that this 1 is at the end of the file... # _Always_ make sure that this 1 is at the end of the file...
1; 1;
Supports Markdown
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