Show More
@@ -348,18 +348,41 b' class DbManage(object):' | |||||
348 | self.sa.rollback() |
|
348 | self.sa.rollback() | |
349 | raise |
|
349 | raise | |
350 |
|
350 | |||
351 | def config_prompt(self, test_repo_path=''): |
|
351 | def config_prompt(self, test_repo_path='', retries=3): | |
352 | log.info('Setting up repositories config') |
|
352 | if retries == 3: | |
|
353 | log.info('Setting up repositories config') | |||
353 |
|
354 | |||
354 | if not self.tests and not test_repo_path: |
|
355 | if not self.tests and not test_repo_path: | |
355 | path = raw_input('Specify valid full path to your repositories' |
|
356 | path = raw_input('Specify valid full path to your repositories' | |
356 | ' you can change this later in application settings:') |
|
357 | ' you can change this later in application settings:') | |
357 | else: |
|
358 | else: | |
358 | path = test_repo_path |
|
359 | path = test_repo_path | |
|
360 | path_ok = True | |||
359 |
|
361 | |||
|
362 | #check proper dir | |||
360 | if not os.path.isdir(path): |
|
363 | if not os.path.isdir(path): | |
361 | log.error('You entered wrong path: %s', path) |
|
364 | path_ok = False | |
|
365 | log.error('Entered path is not a valid directory: %s [%s/3]', | |||
|
366 | path, retries) | |||
|
367 | ||||
|
368 | #check write access | |||
|
369 | if not os.access(path, os.W_OK): | |||
|
370 | path_ok = False | |||
|
371 | ||||
|
372 | log.error('No write permission to given path: %s [%s/3]', | |||
|
373 | path, retries) | |||
|
374 | ||||
|
375 | ||||
|
376 | if retries == 0: | |||
362 | sys.exit() |
|
377 | sys.exit() | |
|
378 | if path_ok is False: | |||
|
379 | retries -= 1 | |||
|
380 | return self.config_prompt(test_repo_path, retries) | |||
|
381 | ||||
|
382 | ||||
|
383 | return path | |||
|
384 | ||||
|
385 | def create_settings(self, path): | |||
363 |
|
386 | |||
364 | self.create_ui_settings() |
|
387 | self.create_ui_settings() | |
365 |
|
388 |
@@ -40,7 +40,7 b' def setup_app(command, conf, vars):' | |||||
40 | dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'], tests=False) |
|
40 | dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'], tests=False) | |
41 | dbmanage.create_tables(override=True) |
|
41 | dbmanage.create_tables(override=True) | |
42 | dbmanage.set_db_version() |
|
42 | dbmanage.set_db_version() | |
43 | dbmanage.config_prompt(None) |
|
43 | dbmanage.create_settings(dbmanage.config_prompt(None)) | |
44 | dbmanage.create_default_user() |
|
44 | dbmanage.create_default_user() | |
45 | dbmanage.admin_prompt() |
|
45 | dbmanage.admin_prompt() | |
46 | dbmanage.create_permissions() |
|
46 | dbmanage.create_permissions() |
General Comments 0
You need to be logged in to leave comments.
Login now