Mercurial > p > roundup > code
comparison roundup/admin.py @ 2633:a9e1fff1e793
I thought I committed this last night. Ho hum.
- This implements most of the rest of the new tracker config layout:
- dbinit.py split between schema.py and initial_data.py
- interfaces.py gone
- tracker and detectors __init__.py gone
- Added some missing functionality to backends: db_exists test and db_nuke.
- Implemented configuration file options in postgresql backend.
- Cleaned up tracker initialisation a lot.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 27 Jul 2004 00:57:19 +0000 |
| parents | dd2b9f5a104c |
| children | d68a444fcce3 |
comparison
equal
deleted
inserted
replaced
| 2632:9c55f2bc5961 | 2633:a9e1fff1e793 |
|---|---|
| 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 18 # | 18 # |
| 19 # $Id: admin.py,v 1.76 2004-07-13 10:21:32 a1s Exp $ | 19 # $Id: admin.py,v 1.77 2004-07-27 00:57:17 richard Exp $ |
| 20 | 20 |
| 21 '''Administration commands for maintaining Roundup trackers. | 21 '''Administration commands for maintaining Roundup trackers. |
| 22 ''' | 22 ''' |
| 23 __docformat__ = 'restructuredtext' | 23 __docformat__ = 'restructuredtext' |
| 24 | 24 |
| 443 tracker = roundup.instance.open(tracker_home) | 443 tracker = roundup.instance.open(tracker_home) |
| 444 except roundup.instance.TrackerError: | 444 except roundup.instance.TrackerError: |
| 445 raise UsageError, _('Instance has not been installed')%locals() | 445 raise UsageError, _('Instance has not been installed')%locals() |
| 446 | 446 |
| 447 # is there already a database? | 447 # is there already a database? |
| 448 try: | 448 if tracker.exists(): |
| 449 db_exists = tracker.select_db.Database.exists(tracker.config) | |
| 450 except AttributeError: | |
| 451 # TODO: move this code to exists() static method in every backend | |
| 452 db_exists = os.path.exists(os.path.join(tracker_home, 'db')) | |
| 453 if db_exists: | |
| 454 ok = raw_input(_( | 449 ok = raw_input(_( |
| 455 """WARNING: The database is already initialised! | 450 """WARNING: The database is already initialised! |
| 456 If you re-initialise it, you will lose all the data! | 451 If you re-initialise it, you will lose all the data! |
| 457 Erase it? Y/N: """)) | 452 Erase it? Y/N: """)) |
| 458 if ok.strip().lower() != 'y': | 453 if ok.strip().lower() != 'y': |
| 459 return 0 | 454 return 0 |
| 460 | 455 |
| 461 # Get a database backend in use by tracker | 456 # nuke it |
| 462 try: | 457 tracker.nuke() |
| 463 # nuke it | |
| 464 tracker.select_db.Database.nuke(tracker.config) | |
| 465 except AttributeError: | |
| 466 # TODO: move this code to nuke() static method in every backend | |
| 467 shutil.rmtree(os.path.join(tracker_home, 'db')) | |
| 468 | 458 |
| 469 # GO | 459 # GO |
| 470 init.initialise(tracker_home, adminpw) | 460 tracker.init(password.Password(adminpw)) |
| 471 | 461 |
| 472 return 0 | 462 return 0 |
| 473 | 463 |
| 474 | 464 |
| 475 def do_get(self, args): | 465 def do_get(self, args): |
