From: shangxdy Date: Tue, 14 Aug 2018 14:03:34 +0000 (+0800) Subject: Bug fixe version info print X-Git-Tag: 1.1.0~4 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=b76a5327b15e3530439db43e1d9d7e29ad5b5d1d;p=parser.git Bug fixe version info print If parser Tosca error happens, it may not exist version info; So it needs a process before print it. JIRA: PARSER-183 Change-Id: I283d1d794b0db19f83a9abc0eee3962e94e21572 Signed-off-by: shangxdy --- diff --git a/tosca2heat/tosca-parser/toscaparser/shell.py b/tosca2heat/tosca-parser/toscaparser/shell.py index 88c7473..83a015c 100644 --- a/tosca2heat/tosca-parser/toscaparser/shell.py +++ b/tosca2heat/tosca-parser/toscaparser/shell.py @@ -97,9 +97,10 @@ class ParserShell(object): else: raise e - version = tosca.version if tosca else "unknown" - if tosca and tosca.version: - print("\nversion: " + version) + if tosca and hasattr(tosca, 'version'): + print("\nversion: " + tosca.version) + else: + print("\nversion: " + "unknown") if tosca and hasattr(tosca, 'description'): description = tosca.description