예제 #1
0
def get_db_version(extension=None):
    if not extension:
        return migration.db_version(sql.get_engine(), find_migrate_repo(), 0)

    try:
        package_name = '.'.join((contrib.__name__, extension))
        package = importutils.import_module(package_name)
    except ImportError:
        raise ImportError(_("%s extension does not exist.") % package_name)

    return migration.db_version(sql.get_engine(), find_migrate_repo(package),
                                0)
예제 #2
0
def get_db_version(extension=None):
    if not extension:
        return migration.db_version(sql.get_engine(), find_migrate_repo(), 0)

    try:
        package_name = '.'.join((contrib.__name__, extension))
        package = importutils.import_module(package_name)
    except ImportError:
        raise ImportError(_("%s extension does not exist.")
                          % package_name)

    return migration.db_version(
        sql.get_engine(), find_migrate_repo(package), 0)
예제 #3
0
def print_db_version(extension=None):
    if not extension:
        print(migration.db_version(find_migrate_repo(), 0))
    else:
        try:
            package_name = '.'.join((contrib.__name__, extension))
            package = importutils.import_module(package_name)
        except ImportError:
            raise ImportError(_("%s extension does not exist.")
                              % package_name)
        try:
            print(migration.db_version(
                find_migrate_repo(package), 0))
        except exception.MigrationNotProvided as e:
            print(e)
            sys.exit(1)
예제 #4
0
파일: cli.py 프로젝트: beamdong/keystone
 def main():
     extension = CONF.command.extension
     if extension:
         try:
             package_name = '.'.join((contrib.__name__, extension))
             package = importutils.import_module(package_name)
         except ImportError:
             raise ImportError(_("%s extension does not exist.")
                               % package_name)
         try:
             print(migration.db_version(
                 migration_helpers.find_migrate_repo(package), 0))
         except exception.MigrationNotProvided as e:
             print(e)
             exit(0)
     else:
         print(migration.db_version(
             migration_helpers.find_migrate_repo(), 0))
예제 #5
0
 def main():
     extension = CONF.command.extension
     if extension:
         try:
             package_name = '.'.join((contrib.__name__, extension))
             package = importutils.import_module(package_name)
         except ImportError:
             raise ImportError(
                 _("%s extension does not exist.") % package_name)
         try:
             print(
                 migration.db_version(
                     migration_helpers.find_migrate_repo(package), 0))
         except exception.MigrationNotProvided as e:
             print(e)
             exit(0)
     else:
         print(
             migration.db_version(migration_helpers.find_migrate_repo(), 0))
예제 #6
0
def db_version(version=None):
    return migration.db_version(_repo_path(), version)