From b76a5327b15e3530439db43e1d9d7e29ad5b5d1d Mon Sep 17 00:00:00 2001 From: shangxdy Date: Tue, 14 Aug 2018 22:03:34 +0800 Subject: 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 --- tosca2heat/tosca-parser/toscaparser/shell.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tosca2heat') 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 -- cgit 1.2.3-korg