add import legacy cli command

Change-Id: I41f0baaf3e7beb5c1ba44a7da420b411c1f60277
This commit is contained in:
termie
2012-02-13 16:50:00 -08:00
parent 48f2f650c8
commit 63adca31f7

View File

@ -1,3 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
from __future__ import absolute_import
import json
@ -56,7 +58,24 @@ class DbSync(BaseApp):
driver.db_sync()
class ImportLegacy(BaseApp):
"""Import a legacy database."""
name = 'import_legacy'
def __init__(self, *args, **kw):
super(ImportLegacy, self).__init__(*args, **kw)
self.add_param('old_db', nargs=1)
def main(self):
from keystone.common.sql import legacy
old_db = self.params.old_db[0]
migration = legacy.LegacyMigration(old_db)
migration.migrate_all()
CMDS = {'db_sync': DbSync,
'import_legacy': ImportLegacy,
}