summaryrefslogtreecommitdiffstats
path: root/tosca2heat/heat-translator/translator/common
diff options
context:
space:
mode:
authorshangxdy <shang.xiaodong@zte.com.cn>2017-07-17 17:40:59 +0800
committershangxdy <shang.xiaodong@zte.com.cn>2017-07-17 17:40:59 +0800
commitc7491340551cdd9d757d63b4bbe79132506e386a (patch)
treeae14fd406f3f0ebe415ce69bd9c6d0698af30d1e /tosca2heat/heat-translator/translator/common
parent859e2826074aa51e0334d4607ccfcde5972e882e (diff)
Synchronize upstream version of 0.9
Synchronize heat-translator wiht upstream versionn of 0.9 JIRA: PARSER-128 Change-Id: I4d2c62a0e81119d5c0305e3ac052415a6d5acee3 Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/heat-translator/translator/common')
-rw-r--r--tosca2heat/heat-translator/translator/common/images.py61
-rw-r--r--tosca2heat/heat-translator/translator/common/utils.py9
2 files changed, 44 insertions, 26 deletions
diff --git a/tosca2heat/heat-translator/translator/common/images.py b/tosca2heat/heat-translator/translator/common/images.py
index f9fa4f1..d9b8818 100644
--- a/tosca2heat/heat-translator/translator/common/images.py
+++ b/tosca2heat/heat-translator/translator/common/images.py
@@ -1,3 +1,4 @@
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
@@ -24,37 +25,46 @@ log = logging.getLogger('heat-translator')
PREDEF_IMAGES = {
'ubuntu-software-config-os-init': {'architecture': 'x86_64',
- 'type': 'Linux',
- 'distribution': 'Ubuntu',
- 'version': '14.04'},
+ 'os_type': 'linux',
+ 'os_distro': 'ubuntu',
+ 'os_version': '14.04'
+ },
+
'ubuntu-12.04-software-config-os-init': {'architecture': 'x86_64',
- 'type': 'Linux',
- 'distribution': 'Ubuntu',
- 'version': '12.04'},
+ 'os_type': 'linux',
+ 'os_distro': 'ubuntu',
+ 'os_version': '12.04'
+ },
'fedora-amd64-heat-config': {'architecture': 'x86_64',
- 'type': 'Linux',
- 'distribution': 'Fedora',
- 'version': '18.0'},
+ 'os_type': 'linux',
+ 'os_distro': 'fedora',
+ 'os_version': '18.0'
+ },
'F18-x86_64-cfntools': {'architecture': 'x86_64',
- 'type': 'Linux',
- 'distribution': 'Fedora',
- 'version': '19'},
+ 'os_type': 'linux',
+ 'os_distro': 'fedora',
+ 'os_version': '19'
+ },
'Fedora-x86_64-20-20131211.1-sda': {'architecture': 'x86_64',
- 'type': 'Linux',
- 'distribution': 'Fedora',
- 'version': '20'},
+ 'os_type': 'linux',
+ 'os_distro': 'fedora',
+ 'os_version': '20'
+ },
'cirros-0.3.1-x86_64-uec': {'architecture': 'x86_64',
- 'type': 'Linux',
- 'distribution': 'CirrOS',
- 'version': '0.3.1'},
+ 'os_type': 'linux',
+ 'os_distro': 'cirros',
+ 'os_version': '0.3.1'
+ },
'cirros-0.3.2-x86_64-uec': {'architecture': 'x86_64',
- 'type': 'Linux',
- 'distribution': 'CirrOS',
- 'version': '0.3.2'},
+ 'os_type': 'linux',
+ 'os_distro': 'cirros',
+ 'os_version': '0.3.2'
+ },
'rhel-6.5-test-image': {'architecture': 'x86_64',
- 'type': 'Linux',
- 'distribution': 'RHEL',
- 'version': '6.5'}
+ 'os_type': 'linux',
+ 'os_distro': 'rhel',
+ 'os_version': '6.5'
+ }
}
SESSION = None
@@ -78,7 +88,8 @@ def get_images():
else:
for image in client.images.list():
image_name = image.name.encode('ascii', 'ignore')
- metadata = ["architecture", "type", "distribution", "version"]
+ metadata = ["architecture", "type", "distribution", "version",
+ "os_distro", "os_type", "os_version"]
if any(key in image.keys() for key in metadata):
IMAGES[image_name] = {}
for key in metadata:
diff --git a/tosca2heat/heat-translator/translator/common/utils.py b/tosca2heat/heat-translator/translator/common/utils.py
index 874c8ec..85af60a 100644
--- a/tosca2heat/heat-translator/translator/common/utils.py
+++ b/tosca2heat/heat-translator/translator/common/utils.py
@@ -216,7 +216,8 @@ class YamlUtils(object):
class TranslationUtils(object):
@staticmethod
- def compare_tosca_translation_with_hot(tosca_file, hot_files, params):
+ def compare_tosca_translation_with_hot(tosca_file, hot_files, params,
+ nested_resources=False):
'''Verify tosca translation against the given hot specification.
inputs:
@@ -247,6 +248,12 @@ class TranslationUtils(object):
basename = os.path.basename(hot_files[0])
output_hot_templates = translate.translate_to_yaml_files_dict(basename)
+
+ if nested_resources:
+ basename = os.path.basename(hot_files[0])
+ output_hot_templates =\
+ translate.translate_to_yaml_files_dict(basename, True)
+
output_dict = {}
for output_hot_template_name in output_hot_templates:
output_dict[output_hot_template_name] = \