From 3d122cfb54343ce717c70d67fc0d4701927bb8ee Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Mon, 26 Nov 2012 13:50:38 +1300 Subject: [PATCH] Pass template as a string if it is not JSON. Test for JSON is whether the first character is '{' Change-Id: I109d5f12d3874517561631eefac514342761714b --- heatclient/v1/shell.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index 8502c9ac..82f537aa 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -22,7 +22,11 @@ import heatclient.exc as exc def _set_template_fields(hc, args, fields): if args.template_file: - fields['template'] = json.loads(open(args.template_file).read()) + tpl = open(args.template_file).read() + if tpl.startswith('{'): + fields['template'] = json.loads(tpl) + else: + fields['template'] = tpl elif args.template_url: fields['template_url'] = args.template_url elif args.template_object: