[openstack-dev] Template Validate API

Har-Tal, Liat (Nokia - IL) liat.har-tal at nokia.com
Tue Jun 7 12:34:08 UTC 2016


I added the Template Validation API and it now available through in both API and CLI ☺

Validation tests itself consists of content and structure tests
It is possible to check a single template or several templates by providing a full path as parameter in the API request.

• By given a full path to template file, validate a single template.
• By given a full path to directory, validate all template files inside it.


-  X-Auth-Token (string, required) - Keystone auth token
-  Accept (string) - application/json
-  User-Agent (String)
-  Content-Type (String): application/json

Query Parameters
-  path (string(255), required) - the path to template file or directory

CLI Request Example:
vitrage template validate --path /tmp/broken_templates

URL Request Example:

POST /v1/template/?path=/tmp/broken_templates/basic.yaml
    User-Agent: keystoneauth1/2.3.0 python-requests/2.9.1 CPython/2.7.6
    Content-Type: application/json
    Accept: application/json
    X-Auth-Token: 2b8882ba2ec44295bf300aecb2caa4f7


Returns a JSON object that is a list of results.
Each result describes the full validation (syntax and content) of one template file.

Result’s fields:
1. status - validation succeeded/failed
2.  file path - the full path to the template file
3. Description
4. message - error message
5. status code

Response Example:

  "results": [
      "status": "validation failed",
      "file path": "/tmp/templates/basic_no_meta.yaml",
      "description": "Template syntax validation",
      "message": "metadata is a mandatory section.",
      "status code": 62
      "status": "validation OK",
      "file path": "/tmp/templates/basic.yaml",
      "description": "Template validation",
      "message": "Template validation is OK",
      "status code": 4

For more information, you can find in Vitrage wiki.


More information about the OpenStack-dev mailing list