Changeset - 8eda822931c9
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2011-05-02 11:45:54
marcin@python-works.com
small fixes for interactive prompt in setup
1 file changed with 4 insertions and 7 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/db_manage.py
Show inline comments
 
@@ -106,25 +106,25 @@ class DbManage(object):
 
        if not upgrade:
 
            sys.exit('Nothing done')
 

	
 
        repository_path = jn(dn(dn(dn(os.path.realpath(__file__)))),
 
                             'rhodecode/lib/dbmigrate')
 
        db_uri = self.dburi
 

	
 
        try:
 
            curr_version = api.db_version(db_uri, repository_path)
 
            msg = ('Found current database under version'
 
                 ' control with version %s' % curr_version)
 

	
 
        except (RuntimeError, DatabaseNotControlledError), e:
 
        except (RuntimeError, DatabaseNotControlledError):
 
            curr_version = 1
 
            msg = ('Current database is not under version control. Setting'
 
                   ' as version %s' % curr_version)
 
            api.version_control(db_uri, repository_path, curr_version)
 

	
 
        print (msg)
 

	
 
        if curr_version == __dbversion__:
 
            sys.exit('This database is already at the newest version')
 

	
 
        #======================================================================
 
        # UPGRADE STEPS
 
@@ -331,33 +331,30 @@ class DbManage(object):
 
            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):
 
            path_ok = False
 
            log.error('Entered path is not a valid directory: %s [%s/3]',
 
                      path, retries)
 
            log.error('Given path %s is not a valid directory', path)
 

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

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

	
 
        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()
0 comments (0 inline, 0 general)