remove pycli
Change-Id: I3236016910479a08e2fd220ebd6793ed06d1b76b
This commit is contained in:
@@ -22,39 +22,26 @@ import sys
|
|||||||
import StringIO
|
import StringIO
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
import cli.app
|
|
||||||
import cli.log
|
|
||||||
|
|
||||||
from keystone import config
|
from keystone import config
|
||||||
from keystone.common import utils
|
from keystone.common import utils
|
||||||
|
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
CONF.set_usage('%prog COMMAND [key1=value1 key2=value2 ...]')
|
CONF.set_usage('%prog COMMAND')
|
||||||
|
|
||||||
|
|
||||||
class BaseApp(cli.log.LoggingApp):
|
class BaseApp(object):
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, argv=None):
|
||||||
kw.setdefault('name', self.__class__.__name__.lower())
|
self.argv = argv
|
||||||
super(BaseApp, self).__init__(*args, **kw)
|
|
||||||
|
|
||||||
def add_default_params(self):
|
def run(self):
|
||||||
for args, kw in DEFAULT_PARAMS:
|
return self.main()
|
||||||
self.add_param(*args, **kw)
|
|
||||||
|
|
||||||
def _parse_keyvalues(self, args):
|
def missing_param(self, param):
|
||||||
kv = {}
|
print 'Missing parameter: %s' % param
|
||||||
for x in args:
|
CONF.print_help()
|
||||||
key, value = x.split('=', 1)
|
print_commands(CMDS)
|
||||||
# make lists if there are multiple values
|
sys.exit(1)
|
||||||
if key.endswith('[]'):
|
|
||||||
key = key[:-2]
|
|
||||||
existing = kv.get(key, [])
|
|
||||||
existing.append(value)
|
|
||||||
kv[key] = existing
|
|
||||||
else:
|
|
||||||
kv[key] = value
|
|
||||||
return kv
|
|
||||||
|
|
||||||
|
|
||||||
class DbSync(BaseApp):
|
class DbSync(BaseApp):
|
||||||
@@ -79,11 +66,12 @@ class ImportLegacy(BaseApp):
|
|||||||
|
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
super(ImportLegacy, self).__init__(*args, **kw)
|
super(ImportLegacy, self).__init__(*args, **kw)
|
||||||
self.add_param('old_db', nargs=1)
|
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
from keystone.common.sql import legacy
|
from keystone.common.sql import legacy
|
||||||
old_db = self.params.old_db[0]
|
if len(self.argv) < 2:
|
||||||
|
return self.missing_param('old_db')
|
||||||
|
old_db = self.argv[1]
|
||||||
migration = legacy.LegacyMigration(old_db)
|
migration = legacy.LegacyMigration(old_db)
|
||||||
migration.migrate_all()
|
migration.migrate_all()
|
||||||
|
|
||||||
@@ -95,11 +83,12 @@ class ExportLegacyCatalog(BaseApp):
|
|||||||
|
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
super(ExportLegacyCatalog, self).__init__(*args, **kw)
|
super(ExportLegacyCatalog, self).__init__(*args, **kw)
|
||||||
self.add_param('old_db', nargs=1)
|
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
from keystone.common.sql import legacy
|
from keystone.common.sql import legacy
|
||||||
old_db = self.params.old_db[0]
|
if len(self.argv) < 2:
|
||||||
|
return self.missing_param('old_db')
|
||||||
|
old_db = self.argv[1]
|
||||||
migration = legacy.LegacyMigration(old_db)
|
migration = legacy.LegacyMigration(old_db)
|
||||||
print '\n'.join(migration.dump_catalog())
|
print '\n'.join(migration.dump_catalog())
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ eventlet
|
|||||||
PasteDeploy
|
PasteDeploy
|
||||||
paste
|
paste
|
||||||
routes
|
routes
|
||||||
pyCLI
|
|
||||||
sqlalchemy
|
sqlalchemy
|
||||||
sqlalchemy-migrate
|
sqlalchemy-migrate
|
||||||
passlib
|
passlib
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ eventlet
|
|||||||
PasteDeploy
|
PasteDeploy
|
||||||
paste
|
paste
|
||||||
routes
|
routes
|
||||||
pyCLI
|
|
||||||
sqlalchemy
|
sqlalchemy
|
||||||
sqlalchemy-migrate
|
sqlalchemy-migrate
|
||||||
passlib
|
passlib
|
||||||
|
|||||||
Reference in New Issue
Block a user