heat.engine.environment module

class heat.engine.environment.ClassResourceInfo(registry, path, value)[source]

Bases: heat.engine.environment.ResourceInfo

Store the mapping of resource name to python class implementation.

description = 'Plugin'
get_class(files=None)[source]
class heat.engine.environment.Environment(env=None, user_env=True)[source]

Bases: object

env_as_dict()[source]

Get the entire environment as a dict.

get_class(resource_type, resource_name=None, files=None)[source]
get_class_to_instantiate(resource_type, resource_name=None)[source]
get_constraint(name)[source]
get_event_sinks()[source]
get_resource_info(resource_type, resource_name=None, registry_type=None, ignore=None)[source]
get_stack_lifecycle_plugins()[source]
get_types(cnxt=None, support_status=None, type_name=None, version=None, with_description=False)[source]
load(env_snippet)[source]
register_class(resource_type, resource_class, path=None)[source]
register_constraint(constraint_name, constraint)[source]
register_event_sink(event_sink_name, event_sink_class)[source]
register_stack_lifecycle_plugin(stack_lifecycle_name, stack_lifecycle_class)[source]
user_env_as_dict()[source]

Get the environment as a dict, only user-allowed keys.

class heat.engine.environment.GlobResourceInfo(registry, path, value)[source]

Bases: heat.engine.environment.MapResourceInfo

Store the mapping (with wild cards) of one resource type to another.

like: OS::Networking::* -> OS::Neutron::*

Also supports many-to-one mapping (mostly useful together with special “OS::Heat::None” resource)

like: OS::* -> OS::Heat::None

description = 'Wildcard Mapping'
get_resource_info(resource_type=None, resource_name=None)[source]
matches(resource_type)[source]
class heat.engine.environment.MapResourceInfo(registry, path, value)[source]

Bases: heat.engine.environment.ResourceInfo

Store the mapping of one resource type to another.

like: OS::Networking::FloatingIp -> OS::Neutron::FloatingIp

description = 'Mapping'
get_class(files=None)[source]
get_resource_info(resource_type=None, resource_name=None)[source]
class heat.engine.environment.ResourceInfo(registry, path, value)[source]

Bases: object

Base mapping of resource type to implementation.

get_class()[source]
get_class_to_instantiate()[source]
get_resource_info(resource_type=None, resource_name=None)[source]
matches(resource_type)[source]
name
path
property registry
user_resource
value
class heat.engine.environment.ResourceRegistry(global_registry, param_defaults)[source]

Bases: object

By looking at the environment, find the resource implementation.

as_dict()[source]

Return user resources in a dict format.

get_class(resource_type, resource_name=None, files=None)[source]
get_class_to_instantiate(resource_type, resource_name=None)[source]
get_resource_info(resource_type, resource_name=None, registry_type=None, ignore=None)[source]

Find possible matches to the resource type and name.

Chain the results from the global and user registry to find a match.

get_rsrc_restricted_actions(resource_name)[source]

Returns a set of restricted actions.

For a given resource we get the set of restricted actions.

Actions are set in this format via resources:

{
    "restricted_actions": [update, replace]
}

A restricted_actions value is either update, replace or a list of those values. Resources support wildcard matching. The asterisk sign matches everything.

get_types(cnxt=None, support_status=None, type_name=None, version=None, with_description=False)[source]

Return a list of valid resource types.

iterable_by(resource_type, resource_name=None)[source]
load(json_snippet)[source]
log_resource_info(show_all=False, prefix=None)[source]
matches_hook(resource_name, hook)[source]

Return whether a resource have a hook set in the environment.

For a given resource and a hook type, we check to see if the passed group of resources has the right hook associated with the name.

Hooks are set in this format via resources:

{
    "res_name": {
        "hooks": [pre-create, pre-update]
    },
    "*_suffix": {
        "hooks": pre-create
    },
    "prefix_*": {
        "hooks": pre-update
    }
}

A hook value is either pre-create, pre-update or a list of those values. Resources support wildcard matching. The asterisk sign matches everything.

register_class(resource_type, resource_class, path=None)[source]
remove_item(info)[source]
remove_resources_except(resource_name)[source]
class heat.engine.environment.TemplateResourceInfo(registry, path, value)[source]

Bases: heat.engine.environment.ResourceInfo

Store the info needed to start a TemplateResource.

description = 'Template'
get_class(files=None)[source]
get_class_to_instantiate()[source]
template_name
heat.engine.environment.get_child_environment(parent_env, child_params, item_to_remove=None, child_resource_name=None)[source]

Build a child environment using the parent environment and params.

This is built from the child_params and the parent env so some resources can use user-provided parameters as if they come from an environment.

  1. resource_registry must be merged (child env should be loaded after the parent env to take precedence).

  2. child parameters must overwrite the parent’s as they won’t be relevant in the child template.

If child_resource_name is provided, resources in the registry will be replaced with the contents of the matching child resource plus anything that passes a wildcard match.

heat.engine.environment.is_hook_definition(key, value)[source]
heat.engine.environment.is_valid_restricted_action(key, value)[source]
heat.engine.environment.read_global_environment(env, env_dir=None)[source]
heat.engine.environment.valid_hook_type(hook)[source]
heat.engine.environment.valid_restricted_actions(action)[source]