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

Doing this will avoid tenant-specific provider template URLs being
shown globally in the resource-type listing.

Co-Authored-By: Angus Salkeld <>
Closes-Bug: #1311223
Change-Id: Ifa18108afacbda390b19b46a8f41bc4f018e95d6
(cherry picked from commit a02ff20509)
This commit is contained in:
Angus Salkeld 2014-05-01 11:20:55 +10:00 committed by Bernhard M. Wiedemann
parent 27557c9abd
commit 03dd894de4
2 changed files with 6 additions and 1 deletions

View File

@ -218,7 +218,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:

View File

@ -432,6 +432,8 @@ class ProviderTemplateTest(HeatTestCase):
'WordPress_Single_Instance.yaml', 'resources': {}},
def test_persisted_unregistered_provider_templates(self):