diff options
Diffstat (limited to 'python')
-rwxr-xr-x | python/londiste.py | 2 | ||||
-rw-r--r-- | python/londiste/handler.py | 24 | ||||
-rw-r--r-- | python/londiste/setup.py | 4 |
3 files changed, 30 insertions, 0 deletions
diff --git a/python/londiste.py b/python/londiste.py index 0b938dbe..542c9c5d 100755 --- a/python/londiste.py +++ b/python/londiste.py @@ -37,6 +37,7 @@ Replication Extra: compare [TBL ...] compare table contents on both sides repair [TBL ...] repair data on subscriber execute [FILE ...] execute SQL files on set + show-handlers [..] show info about all or specific handler Internal Commands: copy copy table logic @@ -48,6 +49,7 @@ cmd_handlers = ( 'drop-node', 'takeover'), londiste.LondisteSetup), (('add-table', 'remove-table', 'add-seq', 'remove-seq', 'tables', 'seqs', 'missing', 'resync', 'check', 'fkeys', 'execute'), londiste.LondisteSetup), + (('show-handlers',), londiste.LondisteSetup), (('worker', 'replay'), londiste.Replicator), (('compare',), londiste.Comparator), (('repair',), londiste.Repairer), diff --git a/python/londiste/handler.py b/python/londiste/handler.py index 9e52db5f..aff0e4ce 100644 --- a/python/londiste/handler.py +++ b/python/londiste/handler.py @@ -146,12 +146,15 @@ _handler_map = { 'londiste': TableHandler, } +_handler_list = _handler_map.keys() + def register_handler_module(modname): """Import and module and register handlers.""" __import__(modname) m = sys.modules[modname] for h in m.__londiste_handlers__: _handler_map[h.handler_name] = h + _handler_list.append(h.handler_name) def _parse_arglist(arglist): args = {} @@ -203,3 +206,24 @@ def load_handler_modules(cf): for m in lst: register_handler_module(m) +def show(mods): + if not mods: + if 0: + names = _handler_map.keys() + names.sort() + else: + names = _handler_list + for n in names: + kls = _handler_map[n] + desc = kls.__doc__ or '' + if desc: + desc = desc.split('\n', 1)[0] + print("%s - %s" % (n, desc)) + else: + for n in mods: + kls = _handler_map[n] + desc = kls.__doc__ or '' + if desc: + desc = desc.rstrip() + print("%s - %s" % (n, desc)) + diff --git a/python/londiste/setup.py b/python/londiste/setup.py index 6ec8ea60..b59fd56f 100644 --- a/python/londiste/setup.py +++ b/python/londiste/setup.py @@ -368,6 +368,10 @@ class LondisteSetup(CascadeAdmin): """TODO: show removed triggers.""" pass + def cmd_show_handlers(self, *args): + """Show help about handlers.""" + londiste.handler.show(args) + def cmd_execute(self, *files): db = self.get_database('db') curs = db.cursor() |