Commit 84cc8e8b authored by Leigh Stoller's avatar Leigh Stoller

Integrate ProtoGENI DB updates into the automated update process.

parent 0e5290ab
......@@ -37,8 +37,11 @@ my $TBOPS = "@TBOPSEMAIL@";
my $DBNAME = "@TBDBNAME@";
my $SRCDIR = "@top_srcdir@";
my $SQLUPDATEDIR = "$SRCDIR/sql/updates";
my $PGENIUPDATEDIR = "$SRCDIR/protogeni/updates";
my $UPDATEDIR = "$SRCDIR/install/updates";
my $DBUPDATE = "$TB/sbin/dbupdate";
my $PGENIUPDATE = "$TB/sbin/protogeni/update";
my $PGENISUPPORT = @PROTOGENI_SUPPORT@;
my $INSTALLUPDATE= "$TB/sbin/update-install";
my $SETSITEVAR = "$TB/sbin/setsitevar";
my $STARTUP = "/usr/local/etc/rc.d/3.testbed.sh";
......@@ -172,6 +175,14 @@ if ($verify) {
$exitval++
if ($?);
if ($PGENISUPPORT) {
print "Checking for ProtoGENI DB updates ...\n";
system("perl @INCDIRS ../protogeni/scripts/update ".
" -q -v -p $PGENIUPDATEDIR");
$exitval++
if ($?);
}
exit(0)
if (!$exitval);
......@@ -297,6 +308,14 @@ system("perl @INCDIRS ./update-install $forceopt -q -a pre -p $UPDATEDIR");
exit(1)
if ($?);
if ($PGENISUPPORT) {
print "Running ProtoGENI DB updates ...\n";
system("perl @INCDIRS ../protogeni/scripts/update ".
" -q -p $PGENIUPDATEDIR");
exit(1)
if ($?);
}
if ($install) {
print "Installing testbed software ... this will take a while!\n";
print "Output saved to $tempfile\n";
......
......@@ -2,7 +2,7 @@
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -49,24 +49,9 @@ for my $db ( "geni", "geni-ch", "geni-cm" ) {
}
if ( $outofdate ) {
chdir( ".." );
my $objdir = `/bin/pwd`;
chomp($objdir);
print << "EOSTR";
The schemata described in $testbed_srcdir/protogeni/updates differ from
the running databases. As a safety measure, you will not be able to
install until this is resolved.
If you are a user of the emulab software outside of Utah, this is
probably because your database was created for an older version of the
emulab software. You can update your database by:
boss> cd /your/srcdir/protogeni/updates
boss> sudo perl $objdir/scripts/update
EOSTR
print "*** Your ProtoGENI DB schema is out of date with the master.\n";
print " As a safety measure, you will not be able to install until\n";
print " this is resolved.\n";
exit(1);
} else {
exit(0);
......
#!/usr/bin/perl -w
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2008-2009 University of Utah and the Flux Group.
# Copyright (c) 2008-2010 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -13,10 +13,15 @@ use Getopt::Std;
#
sub usage()
{
print "Usage: update\n";
print "Usage: update [-q] [-v] [-d] [-p path]\n";
exit(1);
}
my $optlist = "";
my $optlist = "dvp:q";
my $debug = 0;
my $verify = 0;
my $quiet = 0;
my $path;
my $args = "";
#
# Configure variables
......@@ -56,10 +61,6 @@ use Experiment;
use GeniDB;
use GeniCertificate;
if ($UID != 0) {
fatal("Must be root to run this script\n");
}
#
# Check args.
#
......@@ -67,21 +68,46 @@ my %options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"d"})) {
$debug = 1;
$args .= "-d ";
}
if (defined($options{"q"})) {
$quiet = 1;
$args .= "-q ";
}
if (defined($options{"v"})) {
$verify = 1;
$args .= "-v ";
}
if (defined($options{"p"})) {
$path = $options{"p"};
$args .= "-p $path ";
}
usage()
if (@ARGV);
OneShot();
OneShot()
if (!$verify);
if (!$verify && $UID != 0) {
fatal("Must be root to run this script\n");
}
#
# Apply the dbupdates using the Emulab utility, to all three DBs.
#
system("$DBUPDATE " . GENISA_DBNAME()) == 0
or fatal("Could not apply updates to SA DB");
system("$DBUPDATE " . GENICM_DBNAME()) == 0
or fatal("Could not apply updates to CM DB");
system("$DBUPDATE " . GENICH_DBNAME()) == 0
or fatal("Could not apply updates to CH DB");
#
# Apply the dbupdates using the Emulab utility, to all three DBs.
#
foreach my $name (GENISA_DBNAME(), GENICM_DBNAME(), GENICH_DBNAME()) {
system("$DBUPDATE $args $name");
if ($?) {
exit(1)
if ($verify);
fatal("Could not apply updates to $name DB");
}
}
exit(0);
#
......
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