From 7aa9c4baf6f0283515f080f32c62020d5a70debb Mon Sep 17 00:00:00 2001 From: "Leigh B. Stoller" <stoller@flux.utah.edu> Date: Tue, 25 Jun 2002 21:59:32 +0000 Subject: [PATCH] Some silly changes for ssh upgrade. ssh-keygen args are slightly different. Also for protocol 1 in sshtb. Some error condition fixes in mkacct as well; the error log was not getting email properly, and I'm not really sure why. --- configure | 3 ++- configure.in | 3 ++- tbsetup/mkacct.in | 34 ++++++++++++++++++++++++---------- tbsetup/webnodereboot.in | 20 ++++++++++++++++++++ testsuite/tbstub | 12 ++++++++++++ 5 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 tbsetup/webnodereboot.in diff --git a/configure b/configure index 9493a25fc8..1a0b8d7eae 100755 --- a/configure +++ b/configure @@ -998,6 +998,7 @@ if test "${with_SSH_ARGS+set}" = set; then else SSH_ARGS="-q -o \"BatchMode yes\" -o \"StrictHostKeyChecking no\"" + SSH_ARGS="$SSH_ARGS -o \"Protocol 1\"" fi @@ -1228,7 +1229,7 @@ outfiles="$outfiles Makeconf GNUmakefile \ tbsetup/webmkproj tbsetup/mkproj tbsetup/libtestbed.pm \ tbsetup/portstats tbsetup/vnode_setup tbsetup/staticroutes \ tbsetup/console_setup.proxy tbsetup/exports_setup.proxy \ - tbsetup/checkports tbsetup/webidlecheck \ + tbsetup/checkports tbsetup/webidlecheck tbsetup/webnodereboot \ tip/GNUmakefile \ tmcd/GNUmakefile tmcd/freebsd/GNUmakefile tmcd/linux/GNUmakefile \ tmcd/ron/GNUmakefile \ diff --git a/configure.in b/configure.in index 31373a6c6d..2367f2d3f1 100755 --- a/configure.in +++ b/configure.in @@ -155,6 +155,7 @@ AC_ARG_WITH(SSH_ARGS, SSH_ARGS="$withval" ],[ SSH_ARGS="-q -o \"BatchMode yes\" -o \"StrictHostKeyChecking no\"" + SSH_ARGS="$SSH_ARGS -o \"Protocol 1\"" ]) AC_SUBST(SSH_ARGS) @@ -300,7 +301,7 @@ outfiles="$outfiles Makeconf GNUmakefile \ tbsetup/webmkproj tbsetup/mkproj tbsetup/libtestbed.pm \ tbsetup/portstats tbsetup/vnode_setup tbsetup/staticroutes \ tbsetup/console_setup.proxy tbsetup/exports_setup.proxy \ - tbsetup/checkports tbsetup/webidlecheck \ + tbsetup/checkports tbsetup/webidlecheck tbsetup/webnodereboot \ tip/GNUmakefile \ tmcd/GNUmakefile tmcd/freebsd/GNUmakefile tmcd/linux/GNUmakefile \ tmcd/ron/GNUmakefile \ diff --git a/tbsetup/mkacct.in b/tbsetup/mkacct.in index 35544fd310..45edfa2944 100755 --- a/tbsetup/mkacct.in +++ b/tbsetup/mkacct.in @@ -368,18 +368,28 @@ if ($auditmode) { exit(0); sub fatal { - local($msg) = $_[0]; + my($msg) = @_; + + my $flist = (); + if (defined($logname)) { + $flist = ($logname); + } - SENDMAIL($TBOPS, "mkacct $user Failed", $msg, $TBOPS, undef, - (defined($logname) ? ($logname) : ())); - die("$0: $msg\n"); + SENDMAIL($TBOPS, "mkacct $user Failed", $msg, $TBOPS, undef, $flist); + + if (defined($logname)) { + unlink($logname); + } + die("*** $0:\n". + " $msg\n"); } sub AUDIT($) { my($msg) = @_; - SENDMAIL($TBLOGS, "mkacct $user Complete", $msg, $TBOPS, undef, $logname); + SENDMAIL($TBLOGS, "mkacct $user Complete", $msg, + $TBOPS, undef, ($logname)); } # @@ -417,7 +427,7 @@ sub FirstTime() if ($mypid) { waitpid($mypid, 0); if ($?) { - exit($? >> 0); + fatal("Failed to do firsttime user stuff!"); } return; } @@ -427,9 +437,13 @@ sub FirstTime() TBdbfork(); + # + # Below here, use die() instead of fatal(). + # + if ($dossh) { - if (system("$KEYGEN -P '' -f $SSHDIR/identity")) { - fatal("Failure in ssh-keygen"); + if (system("$KEYGEN -t rsa1 -P '' -f $SSHDIR/identity")) { + die("Failure in ssh-keygen"); } # @@ -460,10 +474,10 @@ sub FirstTime() print "Setting up .forward file for $user.\n"; if (system("echo \"$user_email\" > $HOMEDIR/$user/.forward")) { - fatal("Could not create $HOMEDIR/$user/.forward"); + die("Could not create $HOMEDIR/$user/.forward"); } chmod(0644, "$HOMEDIR/$user/.forward") or - fatal("Could not chmod $HOMEDIR/$user/.forward"); + die("Could not chmod $HOMEDIR/$user/.forward"); } # diff --git a/tbsetup/webnodereboot.in b/tbsetup/webnodereboot.in new file mode 100644 index 0000000000..423d916884 --- /dev/null +++ b/tbsetup/webnodereboot.in @@ -0,0 +1,20 @@ +#!/usr/bin/perl -w +use English; + +# +# This gets invoked from the Web interface. Simply a wrapper for experiment +# termination. +# + +# +# Configure variables +# +my $TB = "@prefix@"; + +# +# Run the real thing, and never return. +# +exec "$TB/bin/node_reboot", @ARGV; + +die("*** $0:\n". + " Could not exec program: $!"); diff --git a/testsuite/tbstub b/testsuite/tbstub index ca7c847206..86a04977e0 100755 --- a/testsuite/tbstub +++ b/testsuite/tbstub @@ -33,6 +33,9 @@ if ($#ARGV != 4) { # The status of the test. $status = ""; +# A counter. +$counter = 0; + sub doexit { if ($status eq "") { $status = "PASS"; @@ -53,6 +56,7 @@ $pid = $::pid; $test = $::test; $dir = $::dir; $dbh = $::dbh; +$db = $::db; sub tb_prerun { my ($cmd,$exitcode) = @_; @@ -63,6 +67,10 @@ sub tb_prerun { } close(TBEXEC); $ecode = ($? >> 8); + +# system("mysqldump --all $db > $cmd-$::counter.txt"); + $::counter++; + if ($ecode != $exitcode) { tb_fail("$cmd - Exit code $ecode, expected $exitcode"); } @@ -102,6 +110,10 @@ sub tb_run { } close(TBEXEC); $ecode = ($? >> 8); + +# system("mysqldump --all $db > $cmd-$::counter.txt"); + $::counter++; + if ($ecode != $exitcode) { tb_fail("$cmd - Exit code $ecode, expected $exitcode"); } -- GitLab