Added check to prevent adding argument without help string

Added addition check in add_argument() to ensure it has help
message is always present per Amrith's suggestion in this review:
https://review.openstack.org/#/c/261425/

Change-Id: Ic6486570d4beb138fdcd0c4e700ccc8d734d3e5e
Closes-Bug: #1530195
This commit is contained in:
Tin Lam
2016-04-12 19:03:04 -05:00
parent 4955d07f03
commit 5d8412432b

View File

@@ -66,6 +66,12 @@ class TroveClientArgumentParser(argparse.ArgumentParser):
def __init__(self, *args, **kwargs):
super(TroveClientArgumentParser, self).__init__(*args, **kwargs)
def add_argument(self, *args, **kwargs):
if kwargs.get('help') is None:
raise Exception(_("An argument '%s' was specified without help.")
% args[0])
super(TroveClientArgumentParser, self).add_argument(*args, **kwargs)
def error(self, message):
"""error(message: string)