Merge "Add <version> arg to keystone-manage db_sync"
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user