|
16 | 16 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
17 | 17 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
18 | 18 | # |
19 | | -# $Id: admin.py,v 1.65 2004-04-03 21:32:24 richard Exp $ |
| 19 | +# $Id: admin.py,v 1.66 2004-04-05 06:24:06 richard Exp $ |
20 | 20 |
|
21 | 21 | '''Administration commands for maintaining Roundup trackers. |
22 | 22 | ''' |
@@ -356,11 +356,23 @@ def do_install(self, tracker_home, args): |
356 | 356 | raise UsageError, _('Not enough arguments supplied') |
357 | 357 |
|
358 | 358 | # make sure the tracker home can be created |
| 359 | + tracker_home = os.path.abspath(tracker_home) |
359 | 360 | parent = os.path.split(tracker_home)[0] |
360 | 361 | if not os.path.exists(parent): |
361 | 362 | raise UsageError, _('Instance home parent directory "%(parent)s"' |
362 | 363 | ' does not exist')%locals() |
363 | 364 |
|
| 365 | + if os.path.exists(os.path.join(tracker_home, 'config.py')): |
| 366 | + print _('WARNING: There appears to be a tracker in ' |
| 367 | + '"%(tracker_home)s"!')%locals() |
| 368 | + print _('If you re-install it, you will lose all the data!') |
| 369 | + ok = raw_input(_('Erase it? Y/N: ')).strip() |
| 370 | + if ok.strip().lower() != 'y': |
| 371 | + return 0 |
| 372 | + |
| 373 | + # clear it out so the install isn't confused |
| 374 | + shutil.rmtree(tracker_home) |
| 375 | + |
364 | 376 | # select template |
365 | 377 | templates = self.listTemplates() |
366 | 378 | template = len(args) > 1 and args[1] or '' |
@@ -439,8 +451,8 @@ def do_initialise(self, tracker_home, args): |
439 | 451 | if db_exists: |
440 | 452 | print _('WARNING: The database is already initialised!') |
441 | 453 | print _('If you re-initialise it, you will lose all the data!') |
442 | | - ok = raw_input(_('Erase it? Y/[N]: ')).strip() |
443 | | - if ok.lower() != 'y': |
| 454 | + ok = raw_input(_('Erase it? Y/N: ')).strip() |
| 455 | + if ok.strip().lower() != 'y': |
444 | 456 | return 0 |
445 | 457 |
|
446 | 458 | # Get a database backend in use by tracker |
|
0 commit comments