The heat.engine.resource ModuleΒΆ

class heat.engine.resource.Resource(name, definition, stack)[source]

Bases: object

Resource.ACTIONS = ('INIT', 'CREATE', 'DELETE', 'UPDATE', 'ROLLBACK', 'SUSPEND', 'RESUME', 'ADOPT', 'SNAPSHOT', 'CHECK')
Resource.ADOPT = 'ADOPT'
Resource.CHECK = 'CHECK'
Resource.COMPLETE = 'COMPLETE'
Resource.CREATE = 'CREATE'
Resource.DELETE = 'DELETE'
Resource.FAILED = 'FAILED'
Resource.FnBase64(data)[source]

For the instrinsic function Fn::Base64.

Parameters:data – the input data.
Returns:the Base64 representation of the input data.
Resource.FnGetAtt(key, *path)[source]

For the intrinsic function Fn::GetAtt.

Parameters:
  • key – the attribute key.
  • path – a list of path components to select from the attribute.
Returns:

the attribute value.

Resource.FnGetRefId()[source]

For the intrinsic function Ref.

Results :the id or name of the resource.
Resource.INIT = 'INIT'
Resource.IN_PROGRESS = 'IN_PROGRESS'
Resource.RESUME = 'RESUME'
Resource.ROLLBACK = 'ROLLBACK'
Resource.SNAPSHOT = 'SNAPSHOT'
Resource.STATUSES = ('IN_PROGRESS', 'FAILED', 'COMPLETE')
Resource.SUSPEND = 'SUSPEND'
Resource.UPDATE = 'UPDATE'
Resource.action_handler_task(action, args=[], action_prefix=None)[source]

A task to call the Resource subclass’s handler methods for an action.

Calls the handle_<ACTION>() method for the given action and then calls the check_<ACTION>_complete() method with the result in a loop until it returns True. If the methods are not provided, the call is omitted.

Any args provided are passed to the handler.

If a prefix is supplied, the handler method handle_<PREFIX>_<ACTION>() is called instead.

Resource.add_dependencies(deps)[source]
Resource.adopt(resource_data)[source]

Adopt the existing resource. Resource subclasses can provide a handle_adopt() method to customise adopt.

Resource.attributes_schema = {}
Resource.ceilometer()[source]
Resource.check()[source]

Checks that the physical resource is in its expected state

Gets the current status of the physical resource and updates the database accordingly. If check is not supported by the resource, default action is to fail and revert the resource’s status to its original state with the added message that check was not performed.

Resource.cinder()[source]
Resource.client(name=None)[source]
Resource.client_plugin(name=None)[source]
Resource.create(*args, **kwargs)[source]

Create the resource. Subclasses should provide a handle_create() method to customise creation.

Resource.data()[source]

Resource data for this resource

Use methods data_set and data_delete to modify the resource data for this resource.

Returns:a dict representing the resource data for this resource.
Resource.data_delete(key)[source]

Remove a resource_data element associated to a resource.

Returns:True if the key existed to delete
Resource.data_set(key, value, redact=False)[source]

Save resource’s key/value pair to database.

Resource.default_client_name = None
Resource.delete(*args, **kwargs)[source]

Delete the resource. Subclasses should provide a handle_delete() method to customise deletion.

Resource.delete_snapshot(*args, **kwargs)[source]
Resource.destroy(*args, **kwargs)[source]

Delete the resource and remove it from the database.

Resource.frozen_definition()[source]
Resource.glance()[source]
Resource.handle_adopt(resource_data=None)[source]
Resource.handle_update(json_snippet=None, tmpl_diff=None, prop_diff=None)[source]
Resource.has_interface(resource_type)[source]

Check to see if this resource is either mapped to resource_type or is a “resource_type”.

Resource.heat()[source]
Resource.identifier()[source]

Return an identifier for this resource.

Resource.implementation_signature()[source]

Return a tuple defining the implementation.

This should be broken down into a definition and an implementation version.

Resource.is_using_neutron()[source]
Resource.keystone()[source]
Resource.metadata[source]

DEPRECATED. use method metadata_get instead.

Resource.metadata_get(refresh=False)[source]
Resource.metadata_set(metadata)[source]
Resource.metadata_update(new_metadata=None)[source]

No-op for resources which don’t explicitly override this method

Resource.neutron()[source]
Resource.nova()[source]
Resource.parsed_template(section=None, default=None)[source]

Return the parsed template data for the resource. May be limited to only one section of the data, in which case a default value may also be supplied.

Resource.physical_resource_name()[source]
Resource.physical_resource_name_limit = 255
Resource.physical_resource_name_or_FnGetRefId()[source]
Resource.prepare_abandon()[source]
Resource.preview()[source]

Default implementation of Resource.preview.

This method should be overridden by child classes for specific behavior.

static Resource.reduce_physical_resource_name(name, limit)[source]

Reduce length of physical resource name to a limit.

The reduced name will consist of the following:

  • the first 2 characters of the name
  • a hyphen
  • the end of the name, truncated on the left to bring the name length within the limit
Parameters:
  • name – The name to reduce the length of
  • limit – The max length limit
Returns:

A name whose length is less than or equal to the limit

Resource.reparse()[source]
Resource.required_by()[source]

Returns a list of names of resources which directly require this resource as a dependency.

Resource.requires_deferred_auth = False
Resource.resource_id_set(inst)[source]
classmethod Resource.resource_to_template(resource_type)[source]
Parameters:resource_type – The resource type to be displayed in the template
Returns:A template where the resource’s properties_schema is mapped as parameters, and the resource’s attributes_schema is mapped as outputs
Resource.resume()[source]

Resume the resource. Subclasses should provide a handle_resume() method to implement resume

Resource.signal(details=None)[source]

signal the resource. Subclasses should provide a handle_signal() method to implement the signal, the base-class raise an exception if no handler is implemented.

Resource.snapshot()[source]

Snapshot the resource and return the created data, if any.

Resource.state[source]

Returns state, tuple of action, status.

Resource.state_reset()[source]

Reset state to (INIT, COMPLETE)

Resource.state_set(action, status, reason='state changed')[source]
Resource.strict_dependency = True
Resource.support_status = <heat.engine.support.SupportStatus object at 0x7fed52e1ce90>
Resource.suspend()[source]

Suspend the resource. Subclasses should provide a handle_suspend() method to implement suspend

Resource.swift()[source]
Resource.trove()[source]
Resource.type()[source]
Resource.update(*args, **kwargs)[source]

update the resource. Subclasses should provide a handle_update() method to customise update, the base-class handle_update will fail by default.

Resource.update_allowed_properties = ()
Resource.update_template_diff(after, before)[source]

Returns the difference between the before and after json snippets. If something has been removed in after which exists in before we set it to None.

Resource.update_template_diff_properties(after_props, before_props)[source]

Returns the changed Properties between the before and after properties. If any property having immutable as True is updated, raises NotSupported error. If any properties have changed which are not in update_allowed_properties, raises UpdateReplace.

Resource.validate()[source]
classmethod Resource.validate_deletion_policy(policy)[source]
exception heat.engine.resource.ResourceInError(status_reason=u'Unknown', **kwargs)[source]

Bases: heat.common.exception.HeatException

ResourceInError.msg_fmt = u'Went to status %(resource_status)s due to "%(status_reason)s"'
exception heat.engine.resource.ResourceUnknownStatus(result=u'Resource failed', **kwargs)[source]

Bases: heat.common.exception.HeatException

ResourceUnknownStatus.msg_fmt = u'%(result)s - Unknown status %(resource_status)s'
exception heat.engine.resource.UpdateReplace(resource_name='Unknown')[source]

Bases: exceptions.Exception

Raised when resource update requires replacement.

heat.engine.resource.get_class(resource_type, resource_name=None)[source]

Return the Resource class for a given resource type.

heat.engine.resource.get_types(support_status)[source]

Return a list of valid resource types.

Previous topic

The heat.engine.api Module

Next topic

The heat.engine.update Module

This Page