Commit 2e109e68 authored by Leigh Stoller's avatar Leigh Stoller

Add little script to check consistency of sql/database-fill.sql against

the DB, when doing main install.

Also updated sql/database-fill.sql while I was at it.
parent cbaf2f39
......@@ -24,7 +24,7 @@ SUBDIRS = lib db assign @optional_subdirs@ ipod security sensors \
pxe tbsetup account tmcd utils www tip capture ipod vis \
sensors os install/newnode_sshkeys
all: all-subdirs
all: all-subdirs
install:
@echo "Choose either boss-install (paper) or ops-install (plastic)"
......@@ -33,7 +33,8 @@ install:
#
# For installation on boss node (okay, paper).
#
boss-install: install-schemacheck install-sitevarscheck install-subdirs install-mkdirs
boss-install: install-schemacheck install-sitevarscheck install-dbfillcheck \
install-subdirs install-mkdirs
@echo "DON'T FORGET TO RUN A POST-INSTALL AS ROOT"
#
......@@ -111,6 +112,15 @@ install-sitevarscheck:
@echo "Checking Site variables..."
$(SITEVARSCHECK)
ifeq ($(TBROOT),/usr/testbed)
DBFILLCHECK= cd $(OBJDIR)/db && perl dbfillcheck
else
DBFILLCHECK= @echo "Skipping DB fill check, since prefix isn't /usr/testbed"
endif
install-dbfillcheck:
@echo "Checking Initial DB Fill ..."
$(DBFILLCHECK)
clean: clean-subdirs
distclean: distclean-subdirs
rm -f Makeconf GNUmakefile config.status config.cache config.log
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
#
# dbfillcheck - Make sure that the initial fill contents on the
# database match the ones in the checked-out source. Exits with value
# 1 if the two differ, 0 if they do not, and -1 if some error (such as
# the mysql server is not running, or the database does not exist)
# prevents us from telling if they differ or not.
#
#
# Configure variables
#
my $testbed_srcdir = "@top_srcdir@";
# Locals
my $master_fill = "$testbed_srcdir/sql/database-fill.sql";
my $export_tables = "../utils/export_tables";
my $tempfile = "/tmp/dbdiff.$$";
my $exitcode = 0;
#
# Diff exits with 2 if a problem. We tell diff to ignore whitespace
# changes and comment lines (line starting with '--').
#
if (system("perl $export_tables | ".
"diff -b -B -I '^--.*\$' $master_fill - > $tempfile") == 2) {
unlink($tempfile);
die("*** $0:\n".
" diff $export_tables failed!\n");
}
# No differences ...
if (!$?) {
unlink($tempfile);
exit(0);
}
#
# Oh well. Cat the diff to stdout and exit with non-zero status.
#
system("cat $tempfile");
unlink($tempfile);
exit(1);
-- MySQL dump 8.22
-- MySQL dump 8.21
--
-- Host: localhost Database: tbdb
---------------------------------------------------------
-- Server version 3.23.54-log
-- Server version 3.23.49-log
--
-- Dumping data for table 'comments'
......@@ -242,14 +242,14 @@ REPLACE INTO state_timeouts VALUES ('USERSTATUS','ACTIVE',0,'');
REPLACE INTO state_timeouts VALUES ('USERSTATUS','FROZEN',0,'');
REPLACE INTO state_timeouts VALUES ('USERSTATUS','NEWUSER',0,'');
REPLACE INTO state_timeouts VALUES ('USERSTATUS','UNAPPROVED',0,'');
REPLACE INTO state_timeouts VALUES ('PCVM','BOOTING',180,'NOTIFY');
REPLACE INTO state_timeouts VALUES ('PCVM','SHUTDOWN',0,'');
REPLACE INTO state_timeouts VALUES ('PCVM','ISUP',0,'');
REPLACE INTO state_timeouts VALUES ('PCVM','TBSETUP',600,'NOTIFY');
REPLACE INTO state_timeouts VALUES ('TBCOMMAND','REBOOT',60,'CMDRETRY');
REPLACE INTO state_timeouts VALUES ('TBCOMMAND','REBOOT',15,'CMDRETRY');
REPLACE INTO state_timeouts VALUES ('TBCOMMAND','POWEROFF',0,'CMDRETRY');
REPLACE INTO state_timeouts VALUES ('TBCOMMAND','POWERON',0,'CMDRETRY');
REPLACE INTO state_timeouts VALUES ('TBCOMMAND','POWERCYCLE',0,'CMDRETRY');
REPLACE INTO state_timeouts VALUES ('PCVM','BOOTING',600,'NOTIFY');
REPLACE INTO state_timeouts VALUES ('PCVM','SHUTDOWN',0,'');
REPLACE INTO state_timeouts VALUES ('PCVM','ISUP',0,'');
REPLACE INTO state_timeouts VALUES ('PCVM','TBSETUP',600,'NOTIFY');
--
-- Dumping data for table 'state_transitions'
......@@ -321,6 +321,7 @@ REPLACE INTO state_transitions VALUES ('PCVM','BOOTING','SHUTDOWN');
REPLACE INTO state_transitions VALUES ('PCVM','BOOTING','TBSETUP');
REPLACE INTO state_transitions VALUES ('PCVM','ISUP','SHUTDOWN');
REPLACE INTO state_transitions VALUES ('PCVM','SHUTDOWN','BOOTING');
REPLACE INTO state_transitions VALUES ('PCVM','SHUTDOWN','SHUTDOWN');
REPLACE INTO state_transitions VALUES ('PCVM','TBSETUP','ISUP');
REPLACE INTO state_transitions VALUES ('PCVM','TBSETUP','SHUTDOWN');
REPLACE INTO state_transitions VALUES ('RELOAD','BOOTING','BOOTING');
......
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