summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--heatclient/common/template_utils.py3
-rw-r--r--heatclient/tests/test_template_utils.py15
2 files changed, 18 insertions, 0 deletions
diff --git a/heatclient/common/template_utils.py b/heatclient/common/template_utils.py
index cdc71cc..ccf5c37 100644
--- a/heatclient/common/template_utils.py
+++ b/heatclient/common/template_utils.py
@@ -136,6 +136,9 @@ def process_environment_and_files(env_path=None, template=None,
def resolve_environment_urls(resource_registry, files, env_base_url):
+ if resource_registry is None:
+ return
+
rr = resource_registry
base_url = rr.get('base_url', env_base_url)
diff --git a/heatclient/tests/test_template_utils.py b/heatclient/tests/test_template_utils.py
index 2b2fce1..6073e9d 100644
--- a/heatclient/tests/test_template_utils.py
+++ b/heatclient/tests/test_template_utils.py
@@ -161,6 +161,21 @@ class ShellEnvironmentTest(testtools.TestCase):
env_dict)
self.assertEqual(tmpl, files[tmpl_url])
+ def test_process_environment_empty_file(self):
+
+ self.m.StubOutWithMock(urlutils, 'urlopen')
+ env_file = '/home/my/dir/env.yaml'
+ env = ''
+
+ urlutils.urlopen('file://%s' % env_file).AndReturn(six.StringIO(env))
+ self.m.ReplayAll()
+
+ files, env_dict = template_utils.process_environment_and_files(
+ env_file)
+
+ self.assertEqual({}, env_dict)
+ self.assertEqual({}, files)
+
def test_no_process_environment_and_files(self):
files, env = template_utils.process_environment_and_files()
self.assertEqual({}, env)