comparison roundup/init.py @ 4904:3b632a25b1b3

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.
author John Kristensen <john@jerrykan.com>
date Sat, 12 Jul 2014 00:03:05 +1000
parents c86bc9646652
children 5251e97b1de0
comparison
equal deleted inserted replaced
4903:48d93e98be7b 4904:3b632a25b1b3
173 for name in 'name description intended-for path'.split(): 173 for name in 'name description intended-for path'.split():
174 f.write(writeHeader(name, info[name])) 174 f.write(writeHeader(name, info[name]))
175 finally: 175 finally:
176 f.close() 176 f.close()
177 177
178 def write_select_db(instance_home, backend, dbdir = 'db'): 178 def write_select_db(instance_home, backend, dbdir=None):
179 ''' Write the file that selects the backend for the tracker 179 ''' Write the file that selects the backend for the tracker
180 ''' 180 '''
181 # dbdir may be a relative pathname, os.path.join does the right 181 # dbdir is only supplied when AdminTool.do_initialise() invokes this
182 # thing when the second component of a join is an absolute path 182 # function and the value is fetched from the tracker config which has
183 dbdir = os.path.join (instance_home, dbdir) 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')
184 if not os.path.exists(dbdir): 187 if not os.path.exists(dbdir):
185 os.makedirs(dbdir) 188 os.makedirs(dbdir)
186 f = open(os.path.join(dbdir, 'backend_name'), 'w') 189 f = open(os.path.join(dbdir, 'backend_name'), 'w')
187 f.write(backend+'\n') 190 f.write(backend+'\n')
188 f.close() 191 f.close()

Roundup Issue Tracker: http://roundup-tracker.org/