Mercurial > p > roundup > code
changeset 4734:c67c925e4037
demo: Remove tracker home completely when nuking. This erases
all detectors/extensions, which gave obscure errors when the
demo was reinitialized with different template.
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Mon, 14 Jan 2013 17:35:48 +0300 |
| parents | a0654b1283a4 |
| children | 0c54c846ea6a |
| files | demo.py |
| diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/demo.py Mon Jan 14 17:10:53 2013 +0300 +++ b/demo.py Mon Jan 14 17:35:48 2013 +0300 @@ -5,6 +5,7 @@ import errno import os +import shutil import socket import sys import urlparse @@ -43,10 +44,17 @@ config['RDBMS_PASSWORD'] = 'rounduptest' config['RDBMS_NAME'] = 'rounduptest' - # see if we have further db nuking to perform - module = backends.get_backend(backend) - if module.db_exists(config): - module.db_nuke(config) + # see if we need to clean up existing directory + if os.path.exists(home): + if os.path.exists(home + '/config.ini'): + # clear everything out to avoid conflicts with former + # extensions and detectors + print "Nuking directory left from the previous demo instance." + shutil.rmtree(home) + else: + print "Error: Refusing to nuke non-tracker directory:" + print " %s" % home + sys.exit(1) template_dir = os.path.join('share', 'roundup', 'templates', template) init.install(home, template_dir)
