From 3f7b5a70e1d84dbe806bf91d37352af327f65a68 Mon Sep 17 00:00:00 2001 From: Ifat Afek Date: Mon, 22 Jan 2018 13:20:54 +0000 Subject: [PATCH] Add type property to the template metadata In order to better support validation and loading of different template types, a mandatory 'type' property was added to the metadata section (in version 2) Change-Id: Iebd3eae2db14266a1cfc9cdd11ad9ee24ab9ff4c --- .../contributor/vitrage-template-format.rst | 12 ++++ .../notes/template-type-4587ad6a39130170.yaml | 4 ++ vitrage/common/constants.py | 5 ++ vitrage/evaluator/template_data.py | 12 +++- .../template_loading/template_loader.py | 7 ++- vitrage/evaluator/template_schemas.py | 10 ++- .../content/template_content_validator.py | 15 +++++ .../content/v1/metadata_validator.py | 29 +++++++++ .../content/v2/metadata_validator.py | 45 ++++++++++++++ .../template_validation/status_messages.py | 5 ++ .../template_syntax_validator.py | 3 +- .../version/v2/v2_execute_mistral.yaml | 1 + .../templates/version/v2/v2_standard.yaml | 32 ++++++++++ .../templates/version/v2/v2_with_func.yaml | 1 + .../evaluator/template_loading/__init__.py | 15 +++++ .../evaluator/template_loading/v2/__init__.py | 15 +++++ .../v2/test_template_loader.py | 51 +++++++++++++++ .../content/v1/test_metadata_validator.py | 62 +++++++++++++++++++ .../content/v2/test_metadata_validator.py | 57 +++++++++++++++++ .../unit/evaluator/test_template_loader.py | 2 +- .../templates/api/v2_definition_template.yaml | 30 +++++++++ .../api/v2_equivalence_template.yaml | 14 +++++ .../templates/api/v2_execute_mistral.yaml | 1 + 23 files changed, 421 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/template-type-4587ad6a39130170.yaml create mode 100644 vitrage/evaluator/template_validation/content/v1/metadata_validator.py create mode 100644 vitrage/evaluator/template_validation/content/v2/metadata_validator.py create mode 100644 vitrage/tests/resources/templates/version/v2/v2_standard.yaml create mode 100644 vitrage/tests/unit/evaluator/template_loading/__init__.py create mode 100644 vitrage/tests/unit/evaluator/template_loading/v2/__init__.py create mode 100644 vitrage/tests/unit/evaluator/template_loading/v2/test_template_loader.py create mode 100644 vitrage/tests/unit/evaluator/template_validation/content/v1/test_metadata_validator.py create mode 100644 vitrage/tests/unit/evaluator/template_validation/content/v2/test_metadata_validator.py create mode 100644 vitrage_tempest_tests/tests/resources/templates/api/v2_definition_template.yaml create mode 100644 vitrage_tempest_tests/tests/resources/templates/api/v2_equivalence_template.yaml diff --git a/doc/source/contributor/vitrage-template-format.rst b/doc/source/contributor/vitrage-template-format.rst index 530477890..eda88ab2a 100644 --- a/doc/source/contributor/vitrage-template-format.rst +++ b/doc/source/contributor/vitrage-template-format.rst @@ -25,6 +25,7 @@ The template is written in YAML language, with the following structure: metadata: version: