Commit 66fa5890 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Catch case when there are no nodes in the testbed, as when setting up

a new testbed.
parent c5aec020
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group. # Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
require("defs.php3"); require("defs.php3");
...@@ -88,6 +88,8 @@ function SHOWSTATS() ...@@ -88,6 +88,8 @@ function SHOWSTATS()
# #
function SHOWFREENODES() function SHOWFREENODES()
{ {
$freecounts = array();
# Get typelist and set freecounts to zero. # Get typelist and set freecounts to zero.
$query_result = $query_result =
DBQueryFatal("select n.type from nodes as n ". DBQueryFatal("select n.type from nodes as n ".
...@@ -97,7 +99,11 @@ function SHOWFREENODES() ...@@ -97,7 +99,11 @@ function SHOWFREENODES()
$type = $row[0]; $type = $row[0];
$freecounts[$type] = 0; $freecounts[$type] = 0;
} }
if (!count($freecounts)) {
return "";
}
# Get free totals by type. # Get free totals by type.
$query_result = $query_result =
DBQueryFatal("select n.eventstate,n.type,count(*) from nodes as n ". DBQueryFatal("select n.eventstate,n.type,count(*) from nodes as n ".
...@@ -119,7 +125,7 @@ function SHOWFREENODES() ...@@ -119,7 +125,7 @@ function SHOWFREENODES()
} }
} }
$output = ""; $output = "";
$freepcs = TBFreePCs(); $freepcs = TBFreePCs();
$reloading = TBReloadingPCs(); $reloading = TBReloadingPCs();
......
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