diff --git a/orm/services/resource_distributor/rds/services/yaml_image_builder.py b/orm/services/resource_distributor/rds/services/yaml_image_builder.py index 6546a0af..8f6099ea 100755 --- a/orm/services/resource_distributor/rds/services/yaml_image_builder.py +++ b/orm/services/resource_distributor/rds/services/yaml_image_builder.py @@ -18,7 +18,7 @@ def create_full_yaml(title, resources, description, outputs): def _properties(alldata, region): - public = True if alldata['visibility'] == "public" else False + public = alldata['visibility'] protected = {0: False, 1: True}[alldata['protected']] tenants = [tenant['customer_id'] for tenant in alldata['customers']] properties = dict( @@ -30,24 +30,23 @@ def _properties(alldata, region): id=str(uuid.UUID(alldata['id'])), tags=alldata['tags'], protected=protected, - copy_from=alldata["url"], + location=alldata["url"], owner=alldata["owner"], - is_public=public, - tenants=str(tenants) + visibility=alldata['visibility'] ) if region['action'] != 'create': properties['deactivate'] = {1: False, 0: True}[alldata['enabled']] - if alldata['properties']: - properties['extra_properties'] = alldata['properties'] + # if alldata['properties']: + # properties['extra_properties'] = alldata['properties'] return properties def _glanceimage(alldata, region): return dict( - type="OS::Glance::Image2", + type="OS::Glance::WebImage", properties=_properties(alldata, region) ) @@ -61,6 +60,6 @@ def yamlbuilder(alldata, region): description = {'description': 'yaml file for region - %s' % region['name']} resources['resources'] = {"glance_image": _glanceimage(alldata, region)} outputs['outputs'] = { - '%s_id' % image_type: {"value": {"get_resource": "%s" % image_type}}} + '%s_id' % image_type: {"value": "{get_resource: %s}" % image_type}} full_yaml = create_full_yaml(title, resources, description, outputs) return full_yaml diff --git a/orm/tests/unit/rds/services/test_image_yaml.py b/orm/tests/unit/rds/services/test_image_yaml.py index fd3e544a..b4ca72e2 100755 --- a/orm/tests/unit/rds/services/test_image_yaml.py +++ b/orm/tests/unit/rds/services/test_image_yaml.py @@ -22,11 +22,14 @@ json_input = { 'image_internal_id': 1 }, 'protected': 1, - 'customers': [{ - 'customer_id': 'abcd-efgh-ijkl-4567', 'image_id': 1 - }, { - 'customer_id': 'opqr-stuv-wxyz-8901', 'image_id': 1 - }], + 'customers': [ + { + 'customer_id': 'abcd-efgh-ijkl-4567', 'image_id': 1 + }, + { + 'customer_id': 'opqr-stuv-wxyz-8901', 'image_id': 1 + }], + 'container_format': 'bare', 'min_disk': 2, 'id': '12345678901234567890123456789012' } @@ -40,20 +43,15 @@ yaml_output = { 'glance_image': { 'properties': { 'container_format': 'bare', 'disk_format': 'raw', - 'is_public': True, - 'copy_from': 'https://mirrors.it.att.com/images/image-name', + 'visibility': 'public', + 'location': 'https://mirrors.it.att.com/images/image-name', 'deactivate': False, 'min_disk': 2, 'min_ram': 0, 'name': 'Ubuntu', 'owner': 'unknown', 'protected': True, 'id': '12345678-9012-3456-7890-123456789012', - 'tenants': ['abcd-efgh-ijkl-4567', 'opqr-stuv-wxyz-8901'], - 'tags': ['abcd-efgh-ijkl-4567', 'mnop-qrst-uvwx-0987'], - 'extra_properties': { - 'key_name': 'Key1', 'key_value': 'Key1.value', - 'image_internal_id': 1 - } + 'tags': ['abcd-efgh-ijkl-4567', 'mnop-qrst-uvwx-0987'] }, - 'type': 'OS::Glance::Image2' + 'type': 'OS::Glance::WebImage' } }, 'heat_template_version': '2015-1-1',