Skip to content

Commit f97738b

Browse files
author
Ralf Schlatterbeck
committed
use config.DATABASE in cases where 'db' was still hard-coded
- in instance when determining the backend - during init after nuking the db it would create 'db'
1 parent 14f5a69 commit f97738b

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

roundup/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def do_initialise(self, tracker_home, args):
508508
tracker.nuke()
509509

510510
# re-write the backend select file
511-
init.write_select_db(tracker_home, backend)
511+
init.write_select_db(tracker_home, backend, tracker.config.DATABASE)
512512

513513
# GO
514514
tracker.init(password.Password(adminpw))

roundup/init.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,12 @@ def saveTemplateInfo(dir, info):
176176
finally:
177177
f.close()
178178

179-
def write_select_db(instance_home, backend):
179+
def write_select_db(instance_home, backend, dbdir = 'db'):
180180
''' Write the file that selects the backend for the tracker
181181
'''
182-
dbdir = os.path.join(instance_home, 'db')
182+
# dbdir may be a relative pathname, os.path.join does the right
183+
# thing when the second component of a join is an absolute path
184+
dbdir = os.path.join (instance_home, dbdir)
183185
if not os.path.exists(dbdir):
184186
os.makedirs(dbdir)
185187
f = open(os.path.join(dbdir, 'backend_name'), 'w')

roundup/instance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(self, tracker_home, optimize=0):
8181

8282
def get_backend_name(self):
8383
o = __builtins__['open']
84-
f = o(os.path.join(self.tracker_home, 'db', 'backend_name'))
84+
f = o(os.path.join(self.config.DATABASE, 'backend_name'))
8585
name = f.readline().strip()
8686
f.close()
8787
return name

0 commit comments

Comments
 (0)