summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshangxdy <shang.xiaodong@zte.com.cn>2018-08-14 22:03:34 +0800
committershangxdy <shang.xiaodong@zte.com.cn>2018-08-14 22:03:34 +0800
commitb76a5327b15e3530439db43e1d9d7e29ad5b5d1d (patch)
treee866c3f58fa68b05e0cdfe30e0cf677c5f01cb2f
parentfcda9807cfa6a89d691877126b406c5d3909d9b9 (diff)
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 <shang.xiaodong@zte.com.cn>
-rw-r--r--tosca2heat/tosca-parser/toscaparser/shell.py7
1 files changed, 4 insertions, 3 deletions
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