1. Olemis Lang
  2. bloodhound-mq

Commits

Olemis Lang  committed 4217117

BH Multiproduct #756 : On product admin failure output error msg, product prefix , subcmd help

  • Participants
  • Parent commits 3459851
  • Branches t756_admin_failmsg

Comments (0)

Files changed (2)

File series

View file
+t756/t756_r1567795_product_admin_failmsg.diff

File t756/t756_r1567795_product_admin_failmsg.diff

View file
+# HG changeset patch
+# Parent 7c71bd9e5fe5089dedc01be42aa4ae89ee8181d7
+BH Multiproduct #756 : Output product admin sub-command message on failure
+
+diff -r 7c71bd9e5fe5 bloodhound_multiproduct/multiproduct/product_admin.py
+--- a/bloodhound_multiproduct/multiproduct/product_admin.py	Wed Feb 12 23:17:59 2014 +0000
++++ b/bloodhound_multiproduct/multiproduct/product_admin.py	Thu Feb 13 17:09:12 2014 -0500
+@@ -302,7 +302,7 @@
+             mgr = self.product_admincmd_mgr(args[0])
+             return mgr.complete_command(args[1:])
+ 
+-    GLOBAL_COMMANDS = ('deploy', 'help', 'hotcopy', 'initenv', 'upgrade')
++    GLOBAL_COMMANDS = ('deploy', 'hotcopy', 'initenv', 'upgrade')
+ 
+     def _do_product_admin(self, prefix, *args):
+         mgr = self.product_admincmd_mgr(prefix)
+@@ -333,7 +333,17 @@
+                 env = mgr.env
+                 TracAdmin.print_doc(TracAdmin.all_docs(env), short=True)
+         else:
+-            mgr.execute_command(*args)
++            try:
++                mgr.execute_command(*args)
++            except AdminCommandError, e:
++                printerr(_("Error: %(msg)s", msg=to_unicode(e)))
++                if e.show_usage:
++                    print
++                    print "Admin command failed in product :", prefix
++                    print
++                    self._do_product_admin(prefix, 'help', *args[:2])
++            except:
++                raise
+ 
+     # IRequestFilter methods
+     def pre_process_request(self, req, handler):