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)
This commit is contained in:
parent
6f91215f39
commit
7e114a3871
@ -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:
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user