Commit f3b3c1fe authored by Leigh B Stoller's avatar Leigh B Stoller

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 3e4462a2 3f7d874b
...@@ -37,8 +37,11 @@ my $TBOPS = "@TBOPSEMAIL@"; ...@@ -37,8 +37,11 @@ my $TBOPS = "@TBOPSEMAIL@";
my $DBNAME = "@TBDBNAME@"; my $DBNAME = "@TBDBNAME@";
my $SRCDIR = "@top_srcdir@"; my $SRCDIR = "@top_srcdir@";
my $SQLUPDATEDIR = "$SRCDIR/sql/updates"; my $SQLUPDATEDIR = "$SRCDIR/sql/updates";
my $PGENIUPDATEDIR = "$SRCDIR/protogeni/updates";
my $UPDATEDIR = "$SRCDIR/install/updates"; my $UPDATEDIR = "$SRCDIR/install/updates";
my $DBUPDATE = "$TB/sbin/dbupdate"; my $DBUPDATE = "$TB/sbin/dbupdate";
my $PGENIUPDATE = "$TB/sbin/protogeni/update";
my $PGENISUPPORT = @PROTOGENI_SUPPORT@;
my $INSTALLUPDATE= "$TB/sbin/update-install"; my $INSTALLUPDATE= "$TB/sbin/update-install";
my $SETSITEVAR = "$TB/sbin/setsitevar"; my $SETSITEVAR = "$TB/sbin/setsitevar";
my $STARTUP = "/usr/local/etc/rc.d/3.testbed.sh"; my $STARTUP = "/usr/local/etc/rc.d/3.testbed.sh";
...@@ -172,6 +175,14 @@ if ($verify) { ...@@ -172,6 +175,14 @@ if ($verify) {
$exitval++ $exitval++
if ($?); if ($?);
if ($PGENISUPPORT) {
print "Checking for ProtoGENI DB updates ...\n";
system("perl @INCDIRS ../protogeni/scripts/update ".
" -q -v -p $PGENIUPDATEDIR");
$exitval++
if ($?);
}
exit(0) exit(0)
if (!$exitval); if (!$exitval);
...@@ -297,6 +308,14 @@ system("perl @INCDIRS ./update-install $forceopt -q -a pre -p $UPDATEDIR"); ...@@ -297,6 +308,14 @@ system("perl @INCDIRS ./update-install $forceopt -q -a pre -p $UPDATEDIR");
exit(1) exit(1)
if ($?); if ($?);
if ($PGENISUPPORT) {
print "Running ProtoGENI DB updates ...\n";
system("perl @INCDIRS ../protogeni/scripts/update ".
" -q -p $PGENIUPDATEDIR");
exit(1)
if ($?);
}
if ($install) { if ($install) {
print "Installing testbed software ... this will take a while!\n"; print "Installing testbed software ... this will take a while!\n";
print "Output saved to $tempfile\n"; print "Output saved to $tempfile\n";
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# GENIPUBLIC-COPYRIGHT # 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. # All rights reserved.
# #
use strict; use strict;
...@@ -49,24 +49,9 @@ for my $db ( "geni", "geni-ch", "geni-cm" ) { ...@@ -49,24 +49,9 @@ for my $db ( "geni", "geni-ch", "geni-cm" ) {
} }
if ( $outofdate ) { if ( $outofdate ) {
chdir( ".." ); print "*** Your ProtoGENI DB schema is out of date with the master.\n";
my $objdir = `/bin/pwd`; print " As a safety measure, you will not be able to install until\n";
chomp($objdir); print " this is resolved.\n";
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
exit(1); exit(1);
} else { } else {
exit(0); exit(0);
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# GENIPUBLIC-COPYRIGHT # 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. # All rights reserved.
# #
use strict; use strict;
...@@ -13,10 +13,15 @@ use Getopt::Std; ...@@ -13,10 +13,15 @@ use Getopt::Std;
# #
sub usage() sub usage()
{ {
print "Usage: update\n"; print "Usage: update [-q] [-v] [-d] [-p path]\n";
exit(1); exit(1);
} }
my $optlist = ""; my $optlist = "dvp:q";
my $debug = 0;
my $verify = 0;
my $quiet = 0;
my $path;
my $args = "";
# #
# Configure variables # Configure variables
...@@ -56,10 +61,6 @@ use Experiment; ...@@ -56,10 +61,6 @@ use Experiment;
use GeniDB; use GeniDB;
use GeniCertificate; use GeniCertificate;
if ($UID != 0) {
fatal("Must be root to run this script\n");
}
# #
# Check args. # Check args.
# #
...@@ -67,21 +68,46 @@ my %options = (); ...@@ -67,21 +68,46 @@ my %options = ();
if (! getopts($optlist, \%options)) { if (! getopts($optlist, \%options)) {
usage(); 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() usage()
if (@ARGV); 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. # 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"); # Apply the dbupdates using the Emulab utility, to all three DBs.
system("$DBUPDATE " . GENICM_DBNAME()) == 0 #
or fatal("Could not apply updates to CM DB"); foreach my $name (GENISA_DBNAME(), GENICM_DBNAME(), GENICH_DBNAME()) {
system("$DBUPDATE " . GENICH_DBNAME()) == 0 system("$DBUPDATE $args $name");
or fatal("Could not apply updates to CH DB"); if ($?) {
exit(1)
if ($verify);
fatal("Could not apply updates to $name DB");
}
}
exit(0); 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