Show More
@@ -60,7 +60,8 b' class DbManage(object):' | |||
|
60 | 60 | self.sa = meta.Session |
|
61 | 61 | |
|
62 | 62 | def create_tables(self, override=False): |
|
63 | """Create a auth database | |
|
63 | """ | |
|
64 | Create a auth database | |
|
64 | 65 | """ |
|
65 | 66 | |
|
66 | 67 | log.info("Any existing database is going to be destroyed") |
@@ -86,7 +87,8 b' class DbManage(object):' | |||
|
86 | 87 | log.info('db version set to: %s', __dbversion__) |
|
87 | 88 | |
|
88 | 89 | def upgrade(self): |
|
89 | """Upgrades given database schema to given revision following | |
|
90 | """ | |
|
91 | Upgrades given database schema to given revision following | |
|
90 | 92 | all needed steps, to perform the upgrade |
|
91 | 93 | |
|
92 | 94 | """ |
@@ -125,7 +127,8 b' class DbManage(object):' | |||
|
125 | 127 | # UPGRADE STEPS |
|
126 | 128 | #====================================================================== |
|
127 | 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 | 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 | 136 | self.klass = klass |
|
134 | 137 | |
|
135 | 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 | 140 | print ('attempting to do database upgrade to version %s' \ |
|
138 | 141 | % __dbversion__) |
|
139 | 142 | api.upgrade(db_uri, repository_path, __dbversion__) |
@@ -160,13 +163,14 b' class DbManage(object):' | |||
|
160 | 163 | |
|
161 | 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 | 167 | for step in upgrade_steps: |
|
165 | 168 | print ('performing upgrade step %s' % step) |
|
166 | 169 | getattr(UpgradeSteps(self), 'step_%s' % step)() |
|
167 | 170 | |
|
168 | 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 | 176 | paths = self.sa.query(RhodeCodeUi)\ |
@@ -183,7 +187,8 b' class DbManage(object):' | |||
|
183 | 187 | raise |
|
184 | 188 | |
|
185 | 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 | 192 | used mostly for anonymous access |
|
188 | 193 | """ |
|
189 | 194 | def_user = self.sa.query(User)\ |
@@ -202,7 +207,8 b' class DbManage(object):' | |||
|
202 | 207 | raise |
|
203 | 208 | |
|
204 | 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 | 214 | hgsettings3 = RhodeCodeSetting('ga_code', '') |
@@ -246,25 +252,26 b' class DbManage(object):' | |||
|
246 | 252 | else: |
|
247 | 253 | log.info('creating admin and regular test users') |
|
248 | 254 | from rhodecode.tests import TEST_USER_ADMIN_LOGIN,\ |
|
249 |
TEST_USER_ADMIN_PASS |
|
|
250 |
TEST_USER_REGULAR_PASS, |
|
|
251 |
TEST_USER_REGULAR2_LOGIN, |
|
|
252 | TEST_USER_REGULAR2_EMAIL | |
|
255 | TEST_USER_ADMIN_PASS, TEST_USER_ADMIN_EMAIL,\ | |
|
256 | TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS,\ | |
|
257 | TEST_USER_REGULAR_EMAIL, TEST_USER_REGULAR2_LOGIN, \ | |
|
258 | TEST_USER_REGULAR2_PASS, TEST_USER_REGULAR2_EMAIL | |
|
253 | 259 | |
|
254 | 260 | self.create_user(TEST_USER_ADMIN_LOGIN, TEST_USER_ADMIN_PASS, |
|
255 | 261 | TEST_USER_ADMIN_EMAIL, True) |
|
256 | ||
|
262 | ||
|
257 | 263 | self.create_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS, |
|
258 | 264 | TEST_USER_REGULAR_EMAIL, False) |
|
259 | ||
|
265 | ||
|
260 | 266 | self.create_user(TEST_USER_REGULAR2_LOGIN, TEST_USER_REGULAR2_PASS, |
|
261 | 267 | TEST_USER_REGULAR2_EMAIL, False) |
|
262 | 268 | |
|
263 | 269 | def create_ui_settings(self): |
|
264 | """Creates ui settings, fills out hooks | |
|
270 | """ | |
|
271 | Creates ui settings, fills out hooks | |
|
265 | 272 | and disables dotencode |
|
273 | """ | |
|
266 | 274 | |
|
267 | """ | |
|
268 | 275 | #HOOKS |
|
269 | 276 | hooks1_key = RhodeCodeUi.HOOK_UPDATE |
|
270 | 277 | hooks1_ = self.sa.query(RhodeCodeUi)\ |
@@ -305,7 +312,7 b' class DbManage(object):' | |||
|
305 | 312 | largefiles = RhodeCodeUi() |
|
306 | 313 | largefiles.ui_section = 'extensions' |
|
307 | 314 | largefiles.ui_key = 'largefiles' |
|
308 |
largefiles.ui_value = ' |
|
|
315 | largefiles.ui_value = '' | |
|
309 | 316 | |
|
310 | 317 | self.sa.add(hooks1) |
|
311 | 318 | self.sa.add(hooks2) |
@@ -341,17 +348,16 b' class DbManage(object):' | |||
|
341 | 348 | path = test_repo_path |
|
342 | 349 | path_ok = True |
|
343 | 350 | |
|
344 | #check proper dir | |
|
351 | # check proper dir | |
|
345 | 352 | if not os.path.isdir(path): |
|
346 | 353 | path_ok = False |
|
347 | 354 | log.error('Given path %s is not a valid directory', path) |
|
348 | 355 | |
|
349 | #check write access | |
|
356 | # check write access | |
|
350 | 357 | if not os.access(path, os.W_OK) and path_ok: |
|
351 | 358 | path_ok = False |
|
352 | 359 | log.error('No write permission to given path %s', path) |
|
353 | 360 | |
|
354 | ||
|
355 | 361 | if retries == 0: |
|
356 | 362 | sys.exit('max retries reached') |
|
357 | 363 | if path_ok is False: |
@@ -422,8 +428,8 b' class DbManage(object):' | |||
|
422 | 428 | name='Anonymous', lastname='User') |
|
423 | 429 | |
|
424 | 430 | def create_permissions(self): |
|
425 | #module.(access|create|change|delete)_[name] | |
|
426 | #module.(read|write|owner) | |
|
431 | # module.(access|create|change|delete)_[name] | |
|
432 | # module.(read|write|owner) | |
|
427 | 433 | perms = [('repository.none', 'Repository no access'), |
|
428 | 434 | ('repository.read', 'Repository read access'), |
|
429 | 435 | ('repository.write', 'Repository write access'), |
General Comments 0
You need to be logged in to leave comments.
Login now