Usage

Validation

Kliko and parameter validation related functions.

kliko.validate.convert_to_parameters_schema(kliko)

Convert a kliko schema into a validator for the parameters generated with a kliko schema.

Parameters:kliko (str) – a kliko definition
Returns:A structure for a pykwalify validator
kliko.validate.validate(kliko_file='/kliko.yml', paramaters_file='/parameters.json')

Validate the kliko and paramaters file and parse the parameters file. Should be run inside the Kliko container.

Parameters:
  • kliko_file (str) – Path to a kliko file
  • paramaters_file (str) – path to a parameters file
Returns:

The validated and parsed paramaters file

kliko.validate.validate_kliko(kliko, version=2)

validate a kliko yaml string

Parameters:kliko – a parsed kliko object
Returns:a (nested) kliko structure
Return type:dict
Raises:an exception if the string can’t be parsed or is not in the following the Kliko schema
kliko.validate.validate_parameters(parameters, kliko)

validate a set of parameters given a kliko definition

Parameters:
  • parameters (dict) – A structure that should follow the given kliko structure
  • kliko (dict) – A nested dict which defines the valid parameters in Kliko format
Returns:

the parsed parameters

Return type:

str

Raises:

an exception if the string can’t be parsed or is not in the defining valid parameters

Docker

Helper functions for using Kliko in combinaton with Docker

kliko.docker.extract_params(docker_client, image_name)
Parameters:
  • docker_client (docker.docker.Client) – a docker client object
  • image_name (str) – name of the image to use for kliko.yml extraction
Returns:

content of the param schema

Return type:

str

Django