diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-01-25 03:54:00 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-01-25 03:54:00 +0000 |
| commit | 56f7ad831765bc0d5446cf8f7cd8675a7527dc9e (patch) | |
| tree | 48ba0d8de5479937d7dc12b6bf954aef1aa8ce04 | |
| parent | b207a49cf9cf8f091fdadc0da06970e016101dc3 (diff) | |
| parent | 8c6e606110e26415f81e4177f433528e659182cb (diff) | |
| download | keystone-56f7ad831765bc0d5446cf8f7cd8675a7527dc9e.tar.gz keystone-56f7ad831765bc0d5446cf8f7cd8675a7527dc9e.tar.xz keystone-56f7ad831765bc0d5446cf8f7cd8675a7527dc9e.zip | |
Merge "Updated bp keystone-configuration for bp keystone-manage2"
| -rw-r--r-- | keystone/manage2/__init__.py | 3 | ||||
| -rw-r--r-- | keystone/manage2/base.py | 11 | ||||
| -rw-r--r-- | keystone/manage2/commands/downgrade_database.py | 6 | ||||
| -rw-r--r-- | keystone/manage2/commands/goto_database.py | 6 | ||||
| -rw-r--r-- | keystone/manage2/commands/sync_database.py | 6 | ||||
| -rw-r--r-- | keystone/manage2/commands/upgrade_database.py | 6 | ||||
| -rw-r--r-- | keystone/manage2/commands/version.py | 6 | ||||
| -rw-r--r-- | keystone/manage2/commands/version_control_database.py | 6 | ||||
| -rw-r--r-- | keystone/manage2/common.py | 2 | ||||
| -rw-r--r-- | keystone/test/client/test_keystone_manage.py | 2 |
10 files changed, 10 insertions, 44 deletions
diff --git a/keystone/manage2/__init__.py b/keystone/manage2/__init__.py index 9b5af47e..8e86fb7a 100644 --- a/keystone/manage2/__init__.py +++ b/keystone/manage2/__init__.py @@ -44,8 +44,7 @@ def main(): subparser = subparsers.add_parser(module_name, help=module.Command.__doc__) - cmd = module.Command() - cmd.append_parser(subparser) + module.Command.append_parser(subparser) # actually parse the command line args or print help args = parser.parse_args() diff --git a/keystone/manage2/base.py b/keystone/manage2/base.py index f964bf36..85088a58 100644 --- a/keystone/manage2/base.py +++ b/keystone/manage2/base.py @@ -1,5 +1,6 @@ import argparse +from keystone import config from keystone.manage2 import common @@ -8,9 +9,6 @@ class BaseCommand(object): # pylint: disable=W0613 def __init__(self, *args, **kwargs): - if not hasattr(self.__class__, '_args'): - self.__class__._args = {} - self.parser = argparse.ArgumentParser(prog=self.__module__, description=self.__doc__) self.append_parser(self.parser) @@ -35,7 +33,7 @@ class BaseCommand(object): :param parser: argparse.ArgumentParser """ - args = cls._args + args = getattr(cls, '_args', {}) for name in args.keys(): try: @@ -59,6 +57,11 @@ class BaseSqlalchemyCommand(BaseCommand): def __init__(self, *args, **kwargs): super(BaseSqlalchemyCommand, self).__init__(*args, **kwargs) + @staticmethod + def _get_connection_string(): + sqla = config.CONF['keystone.backends.sqlalchemy'] + return sqla.sql_connection + # pylint: disable=E1101,W0223 class BaseBackendCommand(BaseCommand): diff --git a/keystone/manage2/commands/downgrade_database.py b/keystone/manage2/commands/downgrade_database.py index cab545a3..3bfbcc20 100644 --- a/keystone/manage2/commands/downgrade_database.py +++ b/keystone/manage2/commands/downgrade_database.py @@ -1,5 +1,4 @@ from keystone.backends.sqlalchemy import migration -from keystone import config from keystone.manage2 import base from keystone.manage2 import common @@ -11,11 +10,6 @@ class Command(base.BaseSqlalchemyCommand): """Downgrades the database to the specified version""" @staticmethod - def _get_connection_string(): - sqla = config.CONF['keystone.backends.sqlalchemy'] - return sqla.sql_connection - - @staticmethod def downgrade_database(version): """Downgrade database to the specified version""" migration.downgrade(Command._get_connection_string(), version=version) diff --git a/keystone/manage2/commands/goto_database.py b/keystone/manage2/commands/goto_database.py index 8d53fb8c..d419c1c7 100644 --- a/keystone/manage2/commands/goto_database.py +++ b/keystone/manage2/commands/goto_database.py @@ -1,5 +1,4 @@ from keystone.backends.sqlalchemy import migration -from keystone import config from keystone.manage2 import base from keystone.manage2 import common @@ -16,11 +15,6 @@ class Command(base.BaseSqlalchemyCommand): """ @staticmethod - def _get_connection_string(): - sqla = config.CONF['keystone.backends.sqlalchemy'] - return sqla.sql_connection - - @staticmethod def goto_database_version(version): """Override database's current migration level""" if not migration.db_goto_version(Command._get_connection_string(), diff --git a/keystone/manage2/commands/sync_database.py b/keystone/manage2/commands/sync_database.py index 464654c5..62092d50 100644 --- a/keystone/manage2/commands/sync_database.py +++ b/keystone/manage2/commands/sync_database.py @@ -1,5 +1,4 @@ from keystone.backends.sqlalchemy import migration -from keystone import config from keystone.manage2 import base from keystone.manage2 import common @@ -11,11 +10,6 @@ class Command(base.BaseSqlalchemyCommand): """Upgrades the database to the latest schema.""" @staticmethod - def _get_connection_string(): - sqla = config.CONF['keystone.backends.sqlalchemy'] - return sqla.sql_connection - - @staticmethod def sync_database(version=None): """Place database under migration control & automatically upgrade""" migration.db_sync(Command._get_connection_string(), version=version) diff --git a/keystone/manage2/commands/upgrade_database.py b/keystone/manage2/commands/upgrade_database.py index 3eee19b8..94884442 100644 --- a/keystone/manage2/commands/upgrade_database.py +++ b/keystone/manage2/commands/upgrade_database.py @@ -1,5 +1,4 @@ from keystone.backends.sqlalchemy import migration -from keystone import config from keystone.manage2 import base from keystone.manage2 import common @@ -11,11 +10,6 @@ class Command(base.BaseSqlalchemyCommand): """Upgrades the database to the specified version.""" @staticmethod - def _get_connection_string(): - sqla = config.CONF['keystone.backends.sqlalchemy'] - return sqla.sql_connection - - @staticmethod def upgrade_database(version): """Upgrade database to the specified version""" migration.upgrade(Command._get_connection_string(), version=version) diff --git a/keystone/manage2/commands/version.py b/keystone/manage2/commands/version.py index 410711ad..8e97346f 100644 --- a/keystone/manage2/commands/version.py +++ b/keystone/manage2/commands/version.py @@ -1,5 +1,4 @@ from keystone.backends.sqlalchemy import migration -from keystone import config from keystone import version from keystone.manage2 import base from keystone.manage2 import common @@ -28,11 +27,6 @@ class Command(base.BaseSqlalchemyCommand): return ' '.join([version.API_VERSION, version.API_VERSION_STATUS]) @staticmethod - def _get_connection_string(): - sqla = config.CONF['keystone.backends.sqlalchemy'] - return sqla.sql_connection - - @staticmethod def get_implementation_version(): """Returns a complete implementation version string""" return version.version() diff --git a/keystone/manage2/commands/version_control_database.py b/keystone/manage2/commands/version_control_database.py index 464e4ff5..f69e206c 100644 --- a/keystone/manage2/commands/version_control_database.py +++ b/keystone/manage2/commands/version_control_database.py @@ -1,5 +1,4 @@ from keystone.backends.sqlalchemy import migration -from keystone import config from keystone.manage2 import base @@ -7,11 +6,6 @@ class Command(base.BaseSqlalchemyCommand): """Places an existing database under version control.""" @staticmethod - def _get_connection_string(): - sqla = config.CONF['keystone.backends.sqlalchemy'] - return sqla.sql_connection - - @staticmethod def version_control_database(): """Place database under migration control""" migration.version_control(Command._get_connection_string()) diff --git a/keystone/manage2/common.py b/keystone/manage2/common.py index 4eb582ba..55624109 100644 --- a/keystone/manage2/common.py +++ b/keystone/manage2/common.py @@ -30,7 +30,7 @@ def arg(name, **kwargs): def get_options(): # Initialize a parser for our configuration paramaters - parser = optparse.OptionParser("usage", version='%%prog %s' + parser = optparse.OptionParser("Usage", version='%%prog %s' % version.version()) config.add_common_options(parser) config.add_log_options(parser) diff --git a/keystone/test/client/test_keystone_manage.py b/keystone/test/client/test_keystone_manage.py index 05a06fa3..d60e8a5c 100644 --- a/keystone/test/client/test_keystone_manage.py +++ b/keystone/test/client/test_keystone_manage.py @@ -30,7 +30,7 @@ class TestKeystoneManage(unittest.TestCase): ] process = subprocess.Popen(cmd, stdout=subprocess.PIPE) result = process.communicate()[0] - self.assertIn('Usage', result) + self.assertIn('usage', result.lower()) def test_keystone_manage_calls(self): """ |
