The heat.engine.stk_defn Module

class heat.engine.stk_defn.ResourceProxy(name, definition, resource_data)[source]

Bases: heat.engine.status.ResourceStatus

A lightweight API for essential data about a resource.

This is the interface through which template functions will access data about particular resources in the stack definition, such as the resource definition and current values of reference IDs and attributes.

Resource proxies for some or all resources in the stack will potentially be loaded for every check resource operation, so it is essential that this API is implemented efficiently, using only the data received over RPC and without reference to the resource data stored in the database.

This API can be considered stable by third-party Template or Function plugins, and no part of it should be changed or removed without an appropriate deprecation process.

FnGetAtt(attr, *path)[source]

For the intrinsic function get_attr.

FnGetAtts()[source]

For the intrinsic function get_attr when getting all attributes.

Returns:a dict of all of the resource’s attribute values, excluding the “show” attribute.
FnGetRefId()[source]

For the intrinsic function get_resource.

action

The current action of the resource.

attributes_schema

A set of the valid top-level attribute names.

This is provided for backwards-compatibility for functions that require a container with all of the valid attribute names in order to validate the template. Other operations on it are invalid because we don’t actually have access to the attributes schema here; hence we return a set instead of a dict.

external_id

The external ID of the resource.

name
state

The current state (action, status) of the resource.

status

The current status of the resource.

t

The resource definition.

class heat.engine.stk_defn.StackDefinition(context, template, stack_identifier, resource_data, parent_info=None)[source]

Bases: object

Class representing the definition of a Stack, but not its current state.

This is the interface through which template functions will access data about the stack definition, including the template and current values of resource reference IDs and attributes.

This API can be considered stable by third-party Template or Function plugins, and no part of it should be changed or removed without an appropriate deprecation process.

all_rsrc_names()[source]

Return the set of names of all resources in the template.

This includes resources that are disabled due to false conditionals.

clone_with_new_template(new_template, stack_identifier, clear_resource_data=False)[source]

Create a new StackDefinition with a different template.

enabled_rsrc_names()[source]

Return the set of names of all enabled resources in the template.

env

The stack’s environment.

get_availability_zones()[source]

Return the list of Nova availability zones.

parent_resource

Return a proxy for the parent resource.

Returns None if the stack is not a provider stack for a TemplateResource.

resource_definition(resource_name)[source]

Return the definition of the given resource.

t

The stack’s template.

heat.engine.stk_defn.add_resource(stack_definition, resource_definition)[source]

Insert the given resource definition into the stack definition.

Add the resource to the template and store any temporary data.

heat.engine.stk_defn.remove_resource(stack_definition, resource_name)[source]

Remove the named resource from the stack definition.

Remove the resource from the template and eliminate references to it.

heat.engine.stk_defn.update_resource_data(stack_definition, resource_name, resource_data)[source]

Store new resource state data for the specified resource.

This function enables the legacy (non-convergence) path to store updated NodeData as resources are created/updated in a single StackDefinition that lasts for the entire lifetime of the stack operation.