##// END OF EJS Templates
fixes #324 proper largefiles extension enable
marcink -
r1783:dde0ef0d beta
parent child Browse files
Show More
@@ -60,7 +60,8 b' class DbManage(object):'
60 self.sa = meta.Session
60 self.sa = meta.Session
61
61
62 def create_tables(self, override=False):
62 def create_tables(self, override=False):
63 """Create a auth database
63 """
64 Create a auth database
64 """
65 """
65
66
66 log.info("Any existing database is going to be destroyed")
67 log.info("Any existing database is going to be destroyed")
@@ -86,7 +87,8 b' class DbManage(object):'
86 log.info('db version set to: %s', __dbversion__)
87 log.info('db version set to: %s', __dbversion__)
87
88
88 def upgrade(self):
89 def upgrade(self):
89 """Upgrades given database schema to given revision following
90 """
91 Upgrades given database schema to given revision following
90 all needed steps, to perform the upgrade
92 all needed steps, to perform the upgrade
91
93
92 """
94 """
@@ -125,7 +127,8 b' class DbManage(object):'
125 # UPGRADE STEPS
127 # UPGRADE STEPS
126 #======================================================================
128 #======================================================================
127 class UpgradeSteps(object):
129 class UpgradeSteps(object):
128 """Those steps follow schema versions so for example schema
130 """
131 Those steps follow schema versions so for example schema
129 for example schema with seq 002 == step_2 and so on.
132 for example schema with seq 002 == step_2 and so on.
130 """
133 """
131
134
@@ -133,7 +136,7 b' class DbManage(object):'
133 self.klass = klass
136 self.klass = klass
134
137
135 def step_0(self):
138 def step_0(self):
136 #step 0 is the schema upgrade, and than follow proper upgrades
139 # step 0 is the schema upgrade, and than follow proper upgrades
137 print ('attempting to do database upgrade to version %s' \
140 print ('attempting to do database upgrade to version %s' \
138 % __dbversion__)
141 % __dbversion__)
139 api.upgrade(db_uri, repository_path, __dbversion__)
142 api.upgrade(db_uri, repository_path, __dbversion__)
@@ -160,13 +163,14 b' class DbManage(object):'
160
163
161 upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1)
164 upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1)
162
165
163 #CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE
166 # CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE
164 for step in upgrade_steps:
167 for step in upgrade_steps:
165 print ('performing upgrade step %s' % step)
168 print ('performing upgrade step %s' % step)
166 getattr(UpgradeSteps(self), 'step_%s' % step)()
169 getattr(UpgradeSteps(self), 'step_%s' % step)()
167
170
168 def fix_repo_paths(self):
171 def fix_repo_paths(self):
169 """Fixes a old rhodecode version path into new one without a '*'
172 """
173 Fixes a old rhodecode version path into new one without a '*'
170 """
174 """
171
175
172 paths = self.sa.query(RhodeCodeUi)\
176 paths = self.sa.query(RhodeCodeUi)\
@@ -183,7 +187,8 b' class DbManage(object):'
183 raise
187 raise
184
188
185 def fix_default_user(self):
189 def fix_default_user(self):
186 """Fixes a old default user with some 'nicer' default values,
190 """
191 Fixes a old default user with some 'nicer' default values,
187 used mostly for anonymous access
192 used mostly for anonymous access
188 """
193 """
189 def_user = self.sa.query(User)\
194 def_user = self.sa.query(User)\
@@ -202,7 +207,8 b' class DbManage(object):'
202 raise
207 raise
203
208
204 def fix_settings(self):
209 def fix_settings(self):
205 """Fixes rhodecode settings adds ga_code key for google analytics
210 """
211 Fixes rhodecode settings adds ga_code key for google analytics
206 """
212 """
207
213
208 hgsettings3 = RhodeCodeSetting('ga_code', '')
214 hgsettings3 = RhodeCodeSetting('ga_code', '')
@@ -246,25 +252,26 b' class DbManage(object):'
246 else:
252 else:
247 log.info('creating admin and regular test users')
253 log.info('creating admin and regular test users')
248 from rhodecode.tests import TEST_USER_ADMIN_LOGIN,\
254 from rhodecode.tests import TEST_USER_ADMIN_LOGIN,\
249 TEST_USER_ADMIN_PASS ,TEST_USER_ADMIN_EMAIL,TEST_USER_REGULAR_LOGIN,\
255 TEST_USER_ADMIN_PASS, TEST_USER_ADMIN_EMAIL,\
250 TEST_USER_REGULAR_PASS,TEST_USER_REGULAR_EMAIL,\
256 TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS,\
251 TEST_USER_REGULAR2_LOGIN,TEST_USER_REGULAR2_PASS,\
257 TEST_USER_REGULAR_EMAIL, TEST_USER_REGULAR2_LOGIN, \
252 TEST_USER_REGULAR2_EMAIL
258 TEST_USER_REGULAR2_PASS, TEST_USER_REGULAR2_EMAIL
253
259
254 self.create_user(TEST_USER_ADMIN_LOGIN, TEST_USER_ADMIN_PASS,
260 self.create_user(TEST_USER_ADMIN_LOGIN, TEST_USER_ADMIN_PASS,
255 TEST_USER_ADMIN_EMAIL, True)
261 TEST_USER_ADMIN_EMAIL, True)
256
262
257 self.create_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS,
263 self.create_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS,
258 TEST_USER_REGULAR_EMAIL, False)
264 TEST_USER_REGULAR_EMAIL, False)
259
265
260 self.create_user(TEST_USER_REGULAR2_LOGIN, TEST_USER_REGULAR2_PASS,
266 self.create_user(TEST_USER_REGULAR2_LOGIN, TEST_USER_REGULAR2_PASS,
261 TEST_USER_REGULAR2_EMAIL, False)
267 TEST_USER_REGULAR2_EMAIL, False)
262
268
263 def create_ui_settings(self):
269 def create_ui_settings(self):
264 """Creates ui settings, fills out hooks
270 """
271 Creates ui settings, fills out hooks
265 and disables dotencode
272 and disables dotencode
273 """
266
274
267 """
268 #HOOKS
275 #HOOKS
269 hooks1_key = RhodeCodeUi.HOOK_UPDATE
276 hooks1_key = RhodeCodeUi.HOOK_UPDATE
270 hooks1_ = self.sa.query(RhodeCodeUi)\
277 hooks1_ = self.sa.query(RhodeCodeUi)\
@@ -305,7 +312,7 b' class DbManage(object):'
305 largefiles = RhodeCodeUi()
312 largefiles = RhodeCodeUi()
306 largefiles.ui_section = 'extensions'
313 largefiles.ui_section = 'extensions'
307 largefiles.ui_key = 'largefiles'
314 largefiles.ui_key = 'largefiles'
308 largefiles.ui_value = '1'
315 largefiles.ui_value = ''
309
316
310 self.sa.add(hooks1)
317 self.sa.add(hooks1)
311 self.sa.add(hooks2)
318 self.sa.add(hooks2)
@@ -341,17 +348,16 b' class DbManage(object):'
341 path = test_repo_path
348 path = test_repo_path
342 path_ok = True
349 path_ok = True
343
350
344 #check proper dir
351 # check proper dir
345 if not os.path.isdir(path):
352 if not os.path.isdir(path):
346 path_ok = False
353 path_ok = False
347 log.error('Given path %s is not a valid directory', path)
354 log.error('Given path %s is not a valid directory', path)
348
355
349 #check write access
356 # check write access
350 if not os.access(path, os.W_OK) and path_ok:
357 if not os.access(path, os.W_OK) and path_ok:
351 path_ok = False
358 path_ok = False
352 log.error('No write permission to given path %s', path)
359 log.error('No write permission to given path %s', path)
353
360
354
355 if retries == 0:
361 if retries == 0:
356 sys.exit('max retries reached')
362 sys.exit('max retries reached')
357 if path_ok is False:
363 if path_ok is False:
@@ -422,8 +428,8 b' class DbManage(object):'
422 name='Anonymous', lastname='User')
428 name='Anonymous', lastname='User')
423
429
424 def create_permissions(self):
430 def create_permissions(self):
425 #module.(access|create|change|delete)_[name]
431 # module.(access|create|change|delete)_[name]
426 #module.(read|write|owner)
432 # module.(read|write|owner)
427 perms = [('repository.none', 'Repository no access'),
433 perms = [('repository.none', 'Repository no access'),
428 ('repository.read', 'Repository read access'),
434 ('repository.read', 'Repository read access'),
429 ('repository.write', 'Repository write access'),
435 ('repository.write', 'Repository write access'),
General Comments 0
You need to be logged in to leave comments. Login now