From 2501094213be6209f0334a15f8934fe2dfdef9b1 Mon Sep 17 00:00:00 2001 From: tengqm Date: Sun, 15 Feb 2015 19:50:41 +0800 Subject: [PATCH] Added format_output method --- senlinclient/common/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/senlinclient/common/utils.py b/senlinclient/common/utils.py index 6bae0fad..53630d19 100644 --- a/senlinclient/common/utils.py +++ b/senlinclient/common/utils.py @@ -167,3 +167,12 @@ def process_stack_spec(spec): } return new_spec + + +def format_output(output, format='yaml'): + fmt = format.lower() + try: + return supported_formats[fmt](output) + except KeyError: + raise exc.HTTPUnsupported(_('The format(%s) is unsupported.') + % fmt)