Commit 4e2aa2bf authored by Leigh Stoller's avatar Leigh Stoller

Fix for a circular dependency on sitevar testbed_shutdown.

parent fb528ba4
......@@ -83,6 +83,7 @@ BEGIN
}
}
use emdb;
use libEmulab;
use libtestbed;
#
......@@ -141,6 +142,14 @@ my @INCDIRS = ("-I${objdir}", "-I${objdir}/../tbsetup",
"-I@prefix@/lib"
);
# Chicken or Egg.
DBQueryFatal("INSERT INTO sitevariables VALUES ".
" ('general/testbed_shutdown',NULL,'0', ".
" 'Non-zero value indicates that the testbed is shutdown ".
"and scripts should not do anything when they run. ".
"DO NOT SET THIS BY HAND!', 0)")
if (!SiteVarExists("general/testbed_shutdown"));
#
# Dump the testbed version numbers in all modes.
#
......@@ -216,7 +225,8 @@ sub Restart()
}
if ($nologins) {
print "Turning on the web interface and allowing swaps\n";
if (system("$SETSITEVAR web/nologins -") ||
if (system("$SETSITEVAR general/testbed_shutdown -") ||
system("$SETSITEVAR web/nologins -") ||
system("$SETSITEVAR web/message -")) {
print "*** Could not renable the web interface and swapping!\n";
exit(1);
......@@ -250,6 +260,10 @@ if ($stopbed) {
if ($?) {
Fatal("Could not disable web logins and experiment swaps");
}
system("$SETSITEVAR general/testbed_shutdown 1");
if ($?) {
Fatal("Could not set general/testbed_shutdown");
}
$nologins = 1;
print "-> Waiting a few seconds for testbed to quiet down ...\n";
......
......@@ -44,6 +44,7 @@ $| = 1;
use lib "@prefix@/lib";
use libdb;
use libtestbed;
use libEmulab;
#
# Parse command arguments.
......@@ -70,6 +71,14 @@ if ($UID) {
Fatal("This script must be run as root! Maybe use sudo?")
}
# Chicken or Egg.
DBQueryFatal("INSERT INTO sitevariables VALUES ".
" ('general/testbed_shutdown',NULL,'0', ".
" 'Non-zero value indicates that the testbed is shutdown ".
"and scripts should not do anything when they run. ".
"DO NOT SET THIS BY HAND!', 0)")
if (!SiteVarExists("general/testbed_shutdown"));
sub Restart()
{
print "Starting up testbed daemons.\n";
......
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