Rfaulk has uploaded a new change for review. https://gerrit.wikimedia.org/r/84951
Change subject: fix - handle bad method names, more verbose help. ...................................................................... fix - handle bad method names, more verbose help. Change-Id: I74a4a981e1769abcf9295cde87832849d8c1f3f3 --- M sartoris/config.py M sartoris/git-deploy 2 files changed, 12 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/51/84951/1 diff --git a/sartoris/config.py b/sartoris/config.py index afab7f9..e620cc0 100644 --- a/sartoris/config.py +++ b/sartoris/config.py @@ -68,6 +68,7 @@ 32: 'Failed to write the .deploy file. Exiting.', 40: 'Failed to run sync script. Exiting.', 50: 'Failed to read the .deploy file. Exiting.', + 60: 'Invalid git deploy action. Exiting.', } diff --git a/sartoris/git-deploy b/sartoris/git-deploy index 136f034..7e335c6 100755 --- a/sartoris/git-deploy +++ b/sartoris/git-deploy @@ -15,7 +15,7 @@ import argparse from sartoris.sartoris import SartorisError, Sartoris -from sartoris.config import set_log, log +from sartoris.config import set_log, log, exit_codes def parseargs(): @@ -28,7 +28,8 @@ description="This script performs ", epilog="", conflict_handler="resolve", - usage="sartoris [-q --quiet] [-s --silent] [-v --verbose] [method]" + usage="sartoris [-q --quiet] [-s --silent] [-v --verbose] [method]\n" + "method=[start|sync|abort|revert|diff|show_tag|log_deploys]" ) parser.allow_interspersed_args = False @@ -82,10 +83,16 @@ # Inline call to functionality - if Sartoris does not possess this # attribute flag with logger if not args.method: - log.error(args.help) - return 3 + log.error(exit_codes[3]) + print args.help + return method_exists = hasattr(Sartoris(), args.method) + + if not hasattr(Sartoris(), args.method): + log.error(exit_codes[60]) + return + method_callable = callable(getattr(Sartoris(), args.method)) if method_exists and method_callable: try: -- To view, visit https://gerrit.wikimedia.org/r/84951 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I74a4a981e1769abcf9295cde87832849d8c1f3f3 Gerrit-PatchSet: 1 Gerrit-Project: sartoris Gerrit-Branch: master Gerrit-Owner: Rfaulk <rfaulk...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits