summaryrefslogtreecommitdiffstats
path: root/robotframework-onap/eteutils/HEATUtils.py
diff options
context:
space:
mode:
authorYang Xu <yang.xu3@huawei.com>2019-05-05 22:59:57 -0400
committerYang Xu <yang.xu3@huawei.com>2019-05-05 23:02:35 -0400
commit1a18e91083fdd58ea528513fdf85db678deeb0c7 (patch)
tree7ce135517117923d309ebbd73223f1feec79f77e /robotframework-onap/eteutils/HEATUtils.py
parent8ad85420e45ffeafb536de55b31ad68c0d03c986 (diff)
Check unicode for string
Change-Id: I2d647a82fa38b1ef9ee5b8a2d80296f069e2f079 Issue-ID: INT-1064 Signed-off-by: Yang Xu <yang.xu3@huawei.com>
Diffstat (limited to 'robotframework-onap/eteutils/HEATUtils.py')
-rw-r--r--robotframework-onap/eteutils/HEATUtils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/robotframework-onap/eteutils/HEATUtils.py b/robotframework-onap/eteutils/HEATUtils.py
index 93d556a..69c026e 100644
--- a/robotframework-onap/eteutils/HEATUtils.py
+++ b/robotframework-onap/eteutils/HEATUtils.py
@@ -12,7 +12,7 @@ class HEATUtils:
def get_yaml(self, template_file):
"""Template Yaml To Json reads a YAML Heat template file returns a JSON string that can be used included in an Openstack Add Stack Request"""
- if isinstance(template_file, str):
+ if isinstance(template_file, str) or isinstance(template_file, unicode):
fin = open(template_file, 'r')
yamlobj = yaml.load(fin)
return yamlobj
@@ -20,7 +20,8 @@ class HEATUtils:
def template_yaml_to_json(self, template_file):
"""Template Yaml To Json reads a YAML Heat template file returns a JSON string that can be used included in an Openstack Add Stack Request"""
- if isinstance(template_file, str):
+ contents = None
+ if isinstance(template_file, str) or isinstance(template_file, unicode):
fin = open(template_file, 'r')
yamlobj = yaml.load(fin)
fin.close()
@@ -35,7 +36,7 @@ class HEATUtils:
def env_yaml_to_json(self, template_file):
"""Env Yaml To JSon reads a YAML Heat env file and returns a JSON string that can be used included in an Openstack Add Stack Request"""
- if isinstance(template_file, str):
+ if isinstance(template_file, str) or isinstance(template_file, unicode):
fin = open(template_file, 'r')
yamlobj = yaml.load(fin)
fin.close()