summaryrefslogtreecommitdiff
path: root/heatclient/shell.py
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@enovance.com>2014-01-07 18:10:39 -0800
committerChmouel Boudjnah <chmouel@enovance.com>2014-01-16 09:21:19 -0800
commit1db0ac2d21662a7b0dc8f951ae91a0335ff3c05d (patch)
tree5de16913d0415f4a92eb96027c03e38944b45f26 /heatclient/shell.py
parent97d945e87995e61920227e5664ee3c55290c6052 (diff)
downloadpython-heatclient-1db0ac2d21662a7b0dc8f951ae91a0335ff3c05d.tar.gz
Raise traceback on error when using CLI and -debug
When --debug is specified to the CLI don't just print the simple error message but actually reraise that error. Change-Id: I616eda8e033342cff7f3412e3a414a7530ef3848 Closes-Bug: #1268202
Diffstat (limited to 'heatclient/shell.py')
-rw-r--r--heatclient/shell.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/heatclient/shell.py b/heatclient/shell.py
index 82b05df..9d136a6 100644
--- a/heatclient/shell.py
+++ b/heatclient/shell.py
@@ -421,12 +421,17 @@ class HelpFormatter(argparse.HelpFormatter):
super(HelpFormatter, self).start_section(heading)
-def main():
+def main(args=None):
try:
- HeatShell().main(sys.argv[1:])
+ if args is None:
+ args = sys.argv[1:]
+ HeatShell().main(args)
except Exception as e:
- print(strutils.safe_encode(six.text_type(e)), file=sys.stderr)
+ if '--debug' in args or '-d' in args:
+ raise
+ else:
+ print(strutils.safe_encode(six.text_type(e)), file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":