heat.engine.template module

heat.engine.template module

class heat.engine.template.Template(template, template_id=None, files=None, env=None)[source]

Bases: collections.abc.Mapping

Abstract base class for template format plugins.

All template formats (both internal and third-party) should derive from Template and implement the abstract functions to provide resource definitions and other data.

This is a stable third-party API. Do not add implementations that are specific to internal template formats. Do not add new abstract methods.

add_output(definition)[source]

Add an output to the template.

The output is passed as a OutputDefinition object.

add_resource(definition, name=None)[source]

Add a resource to the template.

The resource is passed as a ResourceDefinition object. If no name is specified, the name from the ResourceDefinition should be used.

all_param_schemata(files)[source]
condition_functions = {}
conditions(stack)[source]

Return a dictionary of resolved conditions.

classmethod create_empty_template(version=('heat_template_version', '2015-04-30'), from_template=None)[source]

Create an empty template.

Creates a new empty template with given version. If version is not provided, a new empty HOT template of version “2015-04-30” is returned.

Parameters:version – A tuple containing version header of the template version key and value, e.g. ('heat_template_version', '2015-04-30')
Returns:A new empty template.
files
functions = {}
get_section_name(section)[source]

Get the name of a field within a resource or output definition.

Return the name of the given field (specified by the constants given in heat.engine.rsrc_defn and heat.engine.output) in the template format. This is used in error reporting to help users find the location of errors in the template.

Note that ‘section’ here does not refer to a top-level section of the template (like parameters, resources, &c.) as it does everywhere else.

classmethod load(context, template_id, t=None)[source]

Retrieve a Template with the given ID from the database.

merge_snippets(other)[source]
outputs(stack)[source]

Return a dictionary of OutputDefinition objects.

param_schemata(param_defaults=None)[source]

Return a dict of parameters.Schema objects for the parameters.

parameters(stack_identifier, user_params, param_defaults=None)[source]

Return a parameters.Parameters object for the stack.

parse(stack, snippet, path='')[source]
parse_condition(stack, snippet, path='')[source]
remove_all_resources()[source]

Remove all the resources from the template.

remove_resource(name)[source]

Remove a resource from the template.

resource_definitions(stack)[source]

Return a dictionary of ResourceDefinition objects.

store(context)[source]

Store the Template in the database and return its ID.

validate()[source]

Validate the template.

Validates the top-level sections of the template as well as syntax inside select sections. Some sections are not checked here but in code parts that are responsible for working with the respective sections (e.g. parameters are check by parameters schema class).

validate_resource_definitions(stack)[source]

Check validity of resource definitions.

This method is deprecated. Subclasses should validate the resource definitions in the process of generating them when calling resource_definitions(). However, for now this method is still called in case any third-party plugins are relying on this for validation and need time to migrate.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.