Move translator to use new TOSCA parser release
There are couple of things that needs to be changed in heat-translator for it to use TOSCA parser 0.5.0 PyPI release. Change-Id: I25a703ed00b4f03b92d7e41a119c703d0d63d9eb
This commit is contained in:
parent
c3ecdb43d6
commit
396f2186f4
@ -144,7 +144,7 @@ class ToscaComputeTest(TestCase):
|
||||
properties:
|
||||
#left intentionally
|
||||
'''
|
||||
expectedprops = {'flavor': 'm1.nano'}
|
||||
expectedprops = {'flavor': None}
|
||||
self._tosca_compute_test(
|
||||
tpl_snippet,
|
||||
expectedprops)
|
||||
|
@ -112,11 +112,17 @@ class ToscaCompute(HotResource):
|
||||
if host_capability:
|
||||
for prop in host_capability.get_properties_objects():
|
||||
host_cap_props[prop.name] = prop.value
|
||||
flavor = self._best_flavor(host_cap_props)
|
||||
# if HOST properties are not specified, we should not attempt to
|
||||
# find best match of flavor
|
||||
if host_cap_props:
|
||||
flavor = self._best_flavor(host_cap_props)
|
||||
if os_capability:
|
||||
for prop in os_capability.get_properties_objects():
|
||||
os_cap_props[prop.name] = prop.value
|
||||
image = self._best_image(os_cap_props)
|
||||
# if OS properties are not specified, we should not attempt to
|
||||
# find best match of image
|
||||
if os_cap_props:
|
||||
image = self._best_image(os_cap_props)
|
||||
hot_properties['flavor'] = flavor
|
||||
hot_properties['image'] = image
|
||||
return hot_properties
|
||||
@ -155,6 +161,7 @@ class ToscaCompute(HotResource):
|
||||
|
||||
def _populate_image_dict(self):
|
||||
'''Populates and returns the images dict using Glance ReST API'''
|
||||
images_dict = {}
|
||||
try:
|
||||
access_dict = translator.common.utils.get_ks_access_dict()
|
||||
access_token = translator.common.utils.get_token_id(access_dict)
|
||||
@ -170,7 +177,6 @@ class ToscaCompute(HotResource):
|
||||
if glance_response.status_code != 200:
|
||||
return None
|
||||
images = json.loads(glance_response.content)["images"]
|
||||
images_dict = {}
|
||||
for image in images:
|
||||
image_resp = requests.get(glance_url + '/v2/images/' +
|
||||
image["id"],
|
||||
|
@ -317,7 +317,7 @@ class TranslateNodeTemplates(object):
|
||||
elif isinstance(input_value, GetAttribute):
|
||||
# for the attribute
|
||||
# get the proper target type to perform the translation
|
||||
args = input_value.result()
|
||||
args = input_value.result().args
|
||||
hot_target = self._find_hot_resource_for_tosca(args[0], resource)
|
||||
|
||||
return hot_target.get_hot_attribute(args[1], args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user