Skip to content

Commit 2553cb2

Browse files
committed
Correctly recreate the database directory during tracker re-initialise
The database directory value was being fetched from the tracker config and being appended to the tracker home directory, but the database directory value in the config already has the tracker home prepended which resulted in the database directory being recreated in a nonsensical location. This fix is a bit of a hack, but the relevant code is likely to be removed in v1.6, so it shouldn't be too bad in the short term.
1 parent 261e7de commit 2553cb2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ Fixed:
121121
application/octet-stream whenever 'html' is contained in the string
122122
(case insensitive). Thanks to Kay Hayen for reporting and helping
123123
debug this. (Ralf Schlatterbeck)
124+
- Correctly recreate the database directory when re-initialising a tracker
125+
instance. (John Kristensen)
124126

125127
Minor:
126128
- demo.py usage message improved: explains "nuke" now. (Bernhard Reiter)

roundup/init.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,15 @@ def saveTemplateInfo(dir, info):
175175
finally:
176176
f.close()
177177

178-
def write_select_db(instance_home, backend, dbdir = 'db'):
178+
def write_select_db(instance_home, backend, dbdir=None):
179179
''' Write the file that selects the backend for the tracker
180180
'''
181-
# dbdir may be a relative pathname, os.path.join does the right
182-
# thing when the second component of a join is an absolute path
183-
dbdir = os.path.join (instance_home, dbdir)
181+
# dbdir is only supplied when AdminTool.do_initialise() invokes this
182+
# function and the value is fetched from the tracker config which has
183+
# already determined the correct path. This is bit of a hack, but it is
184+
# likely this function will be removed in v1.6
185+
if not dbdir:
186+
dbdir = os.path.join(instance_home, 'db')
184187
if not os.path.exists(dbdir):
185188
os.makedirs(dbdir)
186189
f = open(os.path.join(dbdir, 'backend_name'), 'w')

0 commit comments

Comments
 (0)