From 73600a19d58c110282be5307dbcc8479ab1d07bf Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Wed, 30 Jan 2013 18:52:07 -0800 Subject: Remove initialize and update code out of wallet-admin wallet-admin is solely a thin wrapper around Wallet::Admin, but it gained specific code for initialize and update, which caused the server/admin test to fail. Move the update code to set a default version into into Wallet::Admin instead. The initialize code appears to be unnecessary; it was setting a default for a parameter that was already handled by Wallet::Config. Change-Id: I1a7e5dbbfd005e4f60e89e50a91019295e44df99 Reviewed-on: https://gerrit.stanford.edu/729 Reviewed-by: Russ Allbery Tested-by: Russ Allbery --- server/wallet-admin | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'server') diff --git a/server/wallet-admin b/server/wallet-admin index 7e5a402..516423b 100755 --- a/server/wallet-admin +++ b/server/wallet-admin @@ -3,7 +3,7 @@ # wallet-admin -- Wallet server administrative commands. # # Written by Russ Allbery -# Copyright 2008, 2009, 2010, 2011 +# Copyright 2008, 2009, 2010, 2011, 2013 # The Board of Trustees of the Leland Stanford Junior University # # See LICENSE for licensing terms. @@ -15,13 +15,6 @@ use strict; use Wallet::Admin; -# The last non-DBIx::Class version. If a database has no DBIx::Class -# versioning, we want to set it to this so that upgrades can begin. -our $BASE_VERSION = '0.07'; - -# Directory that contains the wallet SQL files for upgrades. -our $SQL_DIR = '/usr/share/wallet/sql/'; - ############################################################################## # Implementation ############################################################################## @@ -48,9 +41,6 @@ sub command { die "too few arguments to initialize\n" if @args < 1; die "invalid admin principal $args[0]\n" unless $args[0] =~ /^[^\@\s]+\@\S+$/; - - my $schema = $admin->{dbh}; - $schema->upgrade_directory ($SQL_DIR); $admin->initialize (@args) or die $admin->error, "\n"; } elsif ($command eq 'register') { die "too many arguments to register\n" if @args > 3; @@ -69,20 +59,7 @@ sub command { } } elsif ($command eq 'upgrade') { die "too many arguments to upgrade\n" if @args; - - my $schema = $admin->{dbh}; - $schema->upgrade_directory ($SQL_DIR); - - # Check to see if the database is versioned. If not, install the - # versioning table and default version. - if (!$schema->get_db_version) { - print "Versioning database.\n"; - $schema->install ($BASE_VERSION); - } - - # Actually upgrade. $admin->upgrade or die $admin->error, "\n"; - } else { die "unknown command $command\n"; } -- cgit v1.2.3