summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authortermie <github@anarkystic.com>2012-01-24 16:49:29 -0800
committertermie <github@anarkystic.com>2012-01-24 16:49:29 -0800
commita6a6124ccd5790bd60eef55880403a4a9f736564 (patch)
tree36f331015973c23eb95e4cb6f701da7f24143a7c /bin
parentf5dbc98dffa3216506453c6dbf038972577fe3fc (diff)
downloadkeystone-a6a6124ccd5790bd60eef55880403a4a9f736564.tar.gz
keystone-a6a6124ccd5790bd60eef55880403a4a9f736564.tar.xz
keystone-a6a6124ccd5790bd60eef55880403a4a9f736564.zip
allow class names to be different from attr names
Diffstat (limited to 'bin')
-rwxr-xr-xbin/keystone-manage13
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/keystone-manage b/bin/keystone-manage
index 9729be09..5193a43a 100755
--- a/bin/keystone-manage
+++ b/bin/keystone-manage
@@ -83,6 +83,12 @@ class DbSync(BaseApp):
class ClientCommand(BaseApp):
ACTION_MAP = None
+ def _attr_name(self):
+ return '%ss' % self.__class__.__name__.lower()
+
+ def _cmd_name(self):
+ return self.__class__.__name__.lower()
+
def __init__(self, *args, **kw):
super(ClientCommand, self).__init__(*args, **kw)
if not self.ACTION_MAP:
@@ -90,7 +96,7 @@ class ClientCommand(BaseApp):
self.add_param('action', nargs='?', default='help')
self.add_param('keyvalues', nargs='*')
self.client = kc.Client(CONF.endpoint, token=CONF.auth_token)
- self.handle = getattr(self.client, '%ss' % self.__class__.__name__.lower())
+ self.handle = getattr(self.client, self._attr_name())
self._build_action_map()
def _build_action_map(self):
@@ -122,7 +128,7 @@ class ClientCommand(BaseApp):
def print_help(self):
CONF.set_usage(CONF.usage.replace(
- 'COMMAND', '%s SUBCOMMAND' % self.__class__.__name__.lower()))
+ 'COMMAND', '%s SUBCOMMAND' % self._cmd_name()))
CONF.print_help()
methods = self._get_methods()
@@ -166,7 +172,8 @@ class User(ClientCommand):
class Ec2(ClientCommand):
- pass
+ def _attr_name(self):
+ return self.__class__.__name__.lower()
CMDS = {'db_sync': DbSync,