Merge "Add <version> arg to keystone-manage db_sync"

This commit is contained in:
Jenkins
2013-05-30 20:35:25 +00:00
committed by Gerrit Code Review
5 changed files with 19 additions and 9 deletions

View File

@@ -50,8 +50,8 @@ class Endpoint(sql.ModelBase, sql.DictBase):
class Catalog(sql.Base, catalog.Driver):
def db_sync(self):
migration.db_sync()
def db_sync(self, version=None):
migration.db_sync(version=version)
# Services
def list_services(self):

View File

@@ -47,12 +47,22 @@ class DbSync(BaseApp):
name = 'db_sync'
@classmethod
def add_argument_parser(cls, subparsers):
parser = super(DbSync, cls).add_argument_parser(subparsers)
parser.add_argument('version', default=None, nargs='?',
help=('Migrate the database up to a specified '
'version. If not provided, db_sync will '
'migrate the database to the latest known '
'version.'))
return parser
@staticmethod
def main():
for k in ['identity', 'catalog', 'policy', 'token', 'credential']:
driver = importutils.import_object(getattr(CONF, k).driver)
if hasattr(driver, 'db_sync'):
driver.db_sync()
driver.db_sync(CONF.command.version)
class BaseCertificateSetup(BaseApp):

View File

@@ -34,8 +34,8 @@ class CredentialModel(sql.ModelBase, sql.DictBase):
class Credential(sql.Base, credential.Driver):
# Internal interface to manage the database
def db_sync(self):
migration.db_sync()
def db_sync(self, version=None):
migration.db_sync(version=version)
# credential crud

View File

@@ -138,8 +138,8 @@ class UserGroupMembership(sql.ModelBase, sql.DictBase):
class Identity(sql.Base, identity.Driver):
# Internal interface to manage the database
def db_sync(self):
migration.db_sync()
def db_sync(self, version=None):
migration.db_sync(version=version)
def _check_password(self, password, user_ref):
"""Check the specified password against the data store.

View File

@@ -31,8 +31,8 @@ class PolicyModel(sql.ModelBase, sql.DictBase):
class Policy(sql.Base, rules.Policy):
# Internal interface to manage the database
def db_sync(self):
migration.db_sync()
def db_sync(self, version=None):
migration.db_sync(version=version)
@sql.handle_conflicts(type='policy')
def create_policy(self, policy_id, policy):