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

Add LookupBySlice() to get instance if we have its underlying slice uuid.

parent 17727950
...@@ -169,6 +169,21 @@ class Instance ...@@ -169,6 +169,21 @@ class Instance
return Instance::Lookup($uuid); return Instance::Lookup($uuid);
} }
function LookupBySlice($token) {
$safe_token = addslashes($token);
$query_result =
DBQueryFatal("select uuid from apt_instances ".
"where slice_uuid='$safe_token'");
if (! ($query_result && mysql_num_rows($query_result))) {
return null;
}
$row = mysql_fetch_row($query_result);
$uuid = $row[0];
return Instance::Lookup($uuid);
}
function LookupByName($project, $token) { function LookupByName($project, $token) {
$safe_token = addslashes($token); $safe_token = addslashes($token);
$pid_idx = $project->pid_idx(); $pid_idx = $project->pid_idx();
......
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