Merge "Fix AttributeError bug when creating nested stacks"

This commit is contained in:
Zuul 2019-08-22 07:37:31 +00:00 committed by Gerrit Code Review
commit 9c696b8a70
4 changed files with 54 additions and 1 deletions

View File

@ -43,7 +43,7 @@ class Proxy(proxy.Proxy):
:rtype: dict
"""
stack_attrs = dict()
envfiles = None
envfiles = dict()
tpl_files = None
if environment_files:
envfiles, env = \

View File

@ -0,0 +1,44 @@
#
# Minimal HOT template defining a single compute server.
#
heat_template_version: 2013-05-23
description: >
Minimal HOT template for stack
parameters:
key_name:
type: string
description: Name of an existing key pair to use for the server
constraints:
- custom_constraint: nova.keypair
flavor:
type: string
description: Flavor for the server to be created
default: m1.small
constraints:
- custom_constraint: nova.flavor
image:
type: string
description: Image ID or image name to use for the server
constraints:
- custom_constraint: glance.image
network:
type: string
description: Network used by the server
resources:
server:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
image: { get_param: image }
flavor: { get_param: flavor }
networks: [{network: {get_param: network} }]
metadata:
message: {get_file: helloworld.txt}
outputs:
server_networks:
description: The networks of the deployed server
value: { get_attr: [server, networks] }

View File

@ -0,0 +1 @@
Hello

View File

@ -306,6 +306,14 @@ class TestOrchestrationProxy(test_proxy_base.TestProxyBase):
ignore_errors=ignore_errors)
self.assertEqual(mock_validate.return_value, res)
def test_validate_template_no_env(self):
tmpl = "openstack/tests/unit/orchestration/v1/hello_world.yaml"
res = self.proxy.read_env_and_templates(tmpl)
self.assertIsInstance(res, dict)
self.assertIsInstance(res["files"], dict)
def test_validate_template_invalid_request(self):
err = self.assertRaises(exceptions.InvalidRequest,
self.proxy.validate_template,