Skip to content

Commit 6aafe01

Browse files
committed
demo: Remove tracker home completely when nuking. This erases
all detectors/extensions, which gave obscure errors when the demo was reinitialized with different template.
1 parent 4ee7800 commit 6aafe01

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

demo.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import errno
77
import os
8+
import shutil
89
import socket
910
import sys
1011
import urlparse
@@ -43,10 +44,17 @@ def install_demo(home, backend, template):
4344
config['RDBMS_PASSWORD'] = 'rounduptest'
4445
config['RDBMS_NAME'] = 'rounduptest'
4546

46-
# see if we have further db nuking to perform
47-
module = backends.get_backend(backend)
48-
if module.db_exists(config):
49-
module.db_nuke(config)
47+
# see if we need to clean up existing directory
48+
if os.path.exists(home):
49+
if os.path.exists(home + '/config.ini'):
50+
# clear everything out to avoid conflicts with former
51+
# extensions and detectors
52+
print "Nuking directory left from the previous demo instance."
53+
shutil.rmtree(home)
54+
else:
55+
print "Error: Refusing to nuke non-tracker directory:"
56+
print " %s" % home
57+
sys.exit(1)
5058

5159
template_dir = os.path.join('share', 'roundup', 'templates', template)
5260
init.install(home, template_dir)

0 commit comments

Comments
 (0)