diff --git a/expandybird/expansion/expansion.py b/expandybird/expansion/expansion.py index 610da71be..162ebbcd0 100755 --- a/expandybird/expansion/expansion.py +++ b/expandybird/expansion/expansion.py @@ -136,7 +136,7 @@ def _ProcessResource(resource, imports, env, validate_schema=False): layout = {'name': resource['name'], 'type': resource['type']} - if IsTemplate(resource['type']): + if IsTemplate(resource['type']) and resource['type'] in imports: # A template resource, which contains sub-resources. expanded_template = ExpandTemplate(resource, imports, env, validate_schema) @@ -145,7 +145,7 @@ def _ProcessResource(resource, imports, env, validate_schema=False): # Process all sub-resources of this template. for resource_to_process in expanded_template['resources']: - processed_resource = _ProcessResource(resource_to_process, imports, env, + processed_resource = _ProcessResource(resource_to_process, imports, env, validate_schema) # Append all sub-resources to the config resources, and the resulting diff --git a/expandybird/expansion/expansion_test.py b/expandybird/expansion/expansion_test.py index db6ee2243..264d5e272 100644 --- a/expandybird/expansion/expansion_test.py +++ b/expandybird/expansion/expansion_test.py @@ -144,12 +144,7 @@ class ExpansionTest(unittest.TestCase): def testNoImportErrors(self): template = 'resources: \n- type: something.jinja\n name: something' - - try: - expansion.Expand(template, {}) - self.fail('Expansion should fail') - except expansion.ExpansionError as e: - self.assertTrue('Unable to find source file' in e.message) + expansion.Expand(template, {}) def testInvalidConfig(self): template = ReadTestFile('invalid_config.yaml')