diff options
author | Angus Salkeld <angus.salkeld@rackspace.com> | 2014-05-01 11:20:55 +1000 |
---|---|---|
committer | Bernhard M. Wiedemann <bwiedemann@suse.de> | 2014-05-21 17:15:38 +0200 |
commit | 7e114a38712da8947ee7ad93eabda34f5e4aa65a (patch) | |
tree | b17c8514877c678a857276266a6791a2fe92733d | |
parent | 6f91215f3902d032b590e2f4d32584b81349daa2 (diff) | |
download | heat-7e114a38712da8947ee7ad93eabda34f5e4aa65a.tar.gz |
Don't dynamically create provider types in the global env
Only support this in user environments.
Note: this is only when you have the following in your template
resources:
thingy:
type: http://example.com/foo.template
Doing this will avoid tenant-specific provider template URLs being
shown globally in the resource-type listing.
Co-Authored-By: Angus Salkeld <angus.salkeld@rackspace.com>
Closes-Bug: #1311223
Change-Id: Ifa18108afacbda390b19b46a8f41bc4f018e95d6
(cherry picked from commit a02ff20509171346d2a1d2a9df7c81aada134c52)
-rw-r--r-- | heat/engine/environment.py | 5 | ||||
-rw-r--r-- | heat/tests/test_provider_template.py | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/heat/engine/environment.py b/heat/engine/environment.py index 6dd73f08f..db9f2e2a6 100644 --- a/heat/engine/environment.py +++ b/heat/engine/environment.py @@ -187,7 +187,10 @@ class ResourceRegistry(object): registry[name] = info def iterable_by(self, resource_type, resource_name=None): - if resource_type.endswith(('.yaml', '.template')): + is_templ_type = resource_type.endswith(('.yaml', '.template')) + if self.global_registry is not None and is_templ_type: + # we only support dynamic resource types in user environments + # not the global environment. # resource with a Type == a template # we dynamically create an entry as it has not been registered. if resource_type not in self._registry: diff --git a/heat/tests/test_provider_template.py b/heat/tests/test_provider_template.py index 500cc5979..e2af880c6 100644 --- a/heat/tests/test_provider_template.py +++ b/heat/tests/test_provider_template.py @@ -398,6 +398,8 @@ class ProviderTemplateTest(HeatTestCase): self.assertIn(attrib, templ_resource.attributes) for k, v in json_snippet.get("Properties").items(): self.assertEqual(v, templ_resource.properties[k]) + self.assertNotIn('WordPress_Single_Instance.yaml', + resources.global_env().registry._registry) def test_system_template_retrieve_by_file(self): # make sure that a TemplateResource defined in the global environment |