From f7b240c6893a48d71da29974e54cb560b6575eb3 Mon Sep 17 00:00:00 2001 From: shangxdy Date: Sun, 26 Feb 2017 16:22:30 +0800 Subject: Sync heat-translator code Sync heat-translator code from upstream JIRA:PARSER-119 Change-Id: I2287b78ad38bc54f7740fd1ee5f08989d5e680bf Signed-off-by: shangxdy --- tosca2heat/heat-translator/translator/osc/v1/translate.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tosca2heat/heat-translator/translator/osc/v1/translate.py') diff --git a/tosca2heat/heat-translator/translator/osc/v1/translate.py b/tosca2heat/heat-translator/translator/osc/v1/translate.py index ef005e2..afe3ba2 100644 --- a/tosca2heat/heat-translator/translator/osc/v1/translate.py +++ b/tosca2heat/heat-translator/translator/osc/v1/translate.py @@ -21,6 +21,8 @@ from cliff import command from toscaparser.tosca_template import ToscaTemplate from toscaparser.utils.gettextutils import _ +from translator.common import flavors +from translator.common import images from translator.common.utils import UrlUtils from translator.conf.config import ConfigProvider from translator.hot.tosca_translator import TOSCATranslator @@ -35,7 +37,7 @@ class TranslateTemplate(command.Command): """Translate a template""" - auth_required = False + auth_required = True def get_parser(self, prog_name): parser = super(TranslateTemplate, self).get_parser(prog_name) @@ -73,6 +75,10 @@ class TranslateTemplate(command.Command): '(%s).'), parsed_args) output = None + session = self.app.cloud.get_session() + flavors.SESSION = session + images.SESSION = session + if parsed_args.parameter: parsed_params = parsed_args.parameter else: @@ -94,7 +100,7 @@ class TranslateTemplate(command.Command): translator = TOSCATranslator(tosca, parsed_params) output = translator.translate() else: - msg = _('Could not find template file.') + msg = _('Could not find template file.\n') log.error(msg) sys.stdout.write(msg) raise SystemExit -- cgit 1.2.3-korg