Fix metadata section not supported in an imported file Edit

Change-Id: I82fa8759984df8e238cbb66d6ef13d7705f30d2e
This commit is contained in:
Miguel Caballer 2018-01-31 16:37:16 +01:00
parent 23cd991e88
commit 3af43cb9a8
4 changed files with 34 additions and 2 deletions

View File

@ -23,12 +23,13 @@ class TypeValidation(object):
DATA_TYPES, ARTIFACT_TYPES, GROUP_TYPES,
RELATIONSHIP_TYPES, CAPABILITY_TYPES,
INTERFACE_TYPES, POLICY_TYPES,
TOPOLOGY_TEMPLATE) = \
TOPOLOGY_TEMPLATE, METADATA) = \
('tosca_definitions_version', 'description', 'imports',
'dsl_definitions', 'node_types', 'repositories',
'data_types', 'artifact_types', 'group_types',
'relationship_types', 'capability_types',
'interface_types', 'policy_types', 'topology_template')
'interface_types', 'policy_types', 'topology_template',
'metadata')
VALID_TEMPLATE_VERSIONS = ['tosca_simple_yaml_1_0']
exttools = ExtTools()
VALID_TEMPLATE_VERSIONS.extend(exttools.get_versions())

View File

@ -0,0 +1,12 @@
tosca_definitions_version: tosca_simple_yaml_1_0
metadata:
template_name: name
template_version: 1.0.0
template_author: me
node_types:
tosca.nodes.SomeNode:
derived_from: tosca.nodes.SoftwareComponent

View File

@ -0,0 +1,13 @@
tosca_definitions_version: tosca_simple_yaml_1_0
imports:
- invalid: custom_types/template_metadata.yaml
description: >
Test to import a template with metadata
topology_template:
node_templates:
test:
type: tosca.nodes.SomeNode

View File

@ -1453,6 +1453,12 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml
'{\'invalid\': \'custom_types/invalid_template_version.yaml\'}"'
' is invalid. Valid versions are "%s".') % valid_versions))
def test_import_template_metadata(self):
tosca_tpl = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"data/test_import_metadata.yml")
ToscaTemplate(tosca_tpl)
def test_node_template_capabilities_properties(self):
# validating capability property values
tpl_snippet = '''