Changeset - 44661d2a7b61
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 15 years ago 2011-02-27 00:31:43
marcin@python-works.com
fixes #120 websetup command runs os.access on given path checking for write access
2 files changed with 27 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/db_manage.py
Show inline comments
 
@@ -348,18 +348,41 @@ class DbManage(object):
 
            self.sa.rollback()
 
            raise
 

	
 
    def config_prompt(self, test_repo_path=''):
 
        log.info('Setting up repositories config')
 
    def config_prompt(self, test_repo_path='', retries=3):
 
        if retries == 3:
 
            log.info('Setting up repositories config')
 

	
 
        if not self.tests and not test_repo_path:
 
            path = raw_input('Specify valid full path to your repositories'
 
                        ' you can change this later in application settings:')
 
        else:
 
            path = test_repo_path
 
        path_ok = True
 

	
 
        #check proper dir
 
        if not os.path.isdir(path):
 
            log.error('You entered wrong path: %s', path)
 
            path_ok = False
 
            log.error('Entered path is not a valid directory: %s [%s/3]',
 
                      path, retries)
 

	
 
        #check write access
 
        if not os.access(path, os.W_OK):
 
            path_ok = False
 

	
 
            log.error('No write permission to given path: %s [%s/3]',
 
                      path, retries)
 

	
 

	
 
        if retries == 0:
 
            sys.exit()
 
        if path_ok is False:
 
            retries -= 1
 
            return self.config_prompt(test_repo_path, retries)
 

	
 

	
 
        return path
 

	
 
    def create_settings(self, path):
 

	
 
        self.create_ui_settings()
 

	
rhodecode/websetup.py
Show inline comments
 
@@ -40,7 +40,7 @@ def setup_app(command, conf, vars):
 
    dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'], tests=False)
 
    dbmanage.create_tables(override=True)
 
    dbmanage.set_db_version()
 
    dbmanage.config_prompt(None)
 
    dbmanage.create_settings(dbmanage.config_prompt(None))
 
    dbmanage.create_default_user()
 
    dbmanage.admin_prompt()
 
    dbmanage.create_permissions()
0 comments (0 inline, 0 general)