From 255fa1ce653b104f8e79b05c6565ceb8d0a0c185 Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 5 Apr 2004 06:24:06 +0000 Subject: [PATCH] roundup-admin install checks for existing tracker in target home git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2255 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 1 + roundup/admin.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 26ee060..b116492 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -18,6 +18,7 @@ Fixed: - added "download_url" method to generate a correctly quoted URL for file download links (sf bug 927745) - all uses of TRACKER_WEB now ensure it ends with a '/' +- roundup-admin install checks for existing tracker in target home 2004-03-27 0.7.0b2 diff --git a/roundup/admin.py b/roundup/admin.py index 0c9fe44..57a7a0c 100644 --- a/roundup/admin.py +++ b/roundup/admin.py @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: admin.py,v 1.65 2004-04-03 21:32:24 richard Exp $ +# $Id: admin.py,v 1.66 2004-04-05 06:24:06 richard Exp $ '''Administration commands for maintaining Roundup trackers. ''' @@ -356,11 +356,23 @@ Command help: raise UsageError, _('Not enough arguments supplied') # make sure the tracker home can be created + tracker_home = os.path.abspath(tracker_home) parent = os.path.split(tracker_home)[0] if not os.path.exists(parent): raise UsageError, _('Instance home parent directory "%(parent)s"' ' does not exist')%locals() + if os.path.exists(os.path.join(tracker_home, 'config.py')): + print _('WARNING: There appears to be a tracker in ' + '"%(tracker_home)s"!')%locals() + print _('If you re-install it, you will lose all the data!') + ok = raw_input(_('Erase it? Y/N: ')).strip() + if ok.strip().lower() != 'y': + return 0 + + # clear it out so the install isn't confused + shutil.rmtree(tracker_home) + # select template templates = self.listTemplates() template = len(args) > 1 and args[1] or '' @@ -439,8 +451,8 @@ Command help: if db_exists: print _('WARNING: The database is already initialised!') print _('If you re-initialise it, you will lose all the data!') - ok = raw_input(_('Erase it? Y/[N]: ')).strip() - if ok.lower() != 'y': + ok = raw_input(_('Erase it? Y/N: ')).strip() + if ok.strip().lower() != 'y': return 0 # Get a database backend in use by tracker -- 2.30.2