- class heat.engine.stack.ConvergenceNode(rsrc_id, is_update)¶
Alias for field number 1
Alias for field number 0
- exception heat.engine.stack.ForcedCancel(with_rollback=True)¶
Exception raised to cancel task execution.
- class heat.engine.stack.Stack(context, stack_name, tmpl, stack_id=None, action=None, status=None, status_reason='', timeout_mins=None, disable_rollback=True, parent_resource=None, owner_id=None, adopt_stack_data=None, stack_user_project_id=None, created_time=None, updated_time=None, user_creds_id=None, tenant_id=None, use_stored_context=False, username=None, nested_depth=0, strict_validate=True, convergence=False, current_traversal=None, tags=None, prev_raw_template_id=None, current_deps=None, cache_data=None, deleted_time=None, converge=False, refresh_cred=False)¶
- ACTIONS = ('CREATE', 'DELETE', 'UPDATE', 'ROLLBACK', 'SUSPEND', 'RESUME', 'ADOPT', 'SNAPSHOT', 'CHECK', 'RESTORE')¶
- ADOPT = 'ADOPT'¶
- CHECK = 'CHECK'¶
- COMPLETE = 'COMPLETE'¶
- CREATE = 'CREATE'¶
- DELETE = 'DELETE'¶
- FAILED = 'FAILED'¶
- IN_PROGRESS = 'IN_PROGRESS'¶
- RESTORE = 'RESTORE'¶
- RESUME = 'RESUME'¶
- ROLLBACK = 'ROLLBACK'¶
- SNAPSHOT = 'SNAPSHOT'¶
- STATUSES = ('IN_PROGRESS', 'FAILED', 'COMPLETE')¶
- SUSPEND = 'SUSPEND'¶
- UPDATE = 'UPDATE'¶
- access_allowed(credential_id, resource_name)¶
Is credential_id authorised to access resource by resource_name.
Insert the given resource into the stack.
Adopt existing resources into a new stack.
- converge_stack(template, action='UPDATE', new_stack=None, pre_converge=None)¶
Update the stack template and trigger convergence for resources.
- property convergence_dependencies¶
Create the stack and all of the resources.
Return whether to defer persisting the state.
If persistence is deferred, the new state will not be written to the database until the stack lock is released (by calling persist_state_and_release_lock()). This prevents races in the legacy path where an observer sees the stack COMPLETE but an engine still holds the lock.
- delete(action='DELETE', backup=False, abandon=False, notify=None)¶
Delete all of the resources, and then the stack itself.
The action parameter is used to differentiate between a user initiated delete and an automatic stack rollback after a failed create, which amount to the same thing, but the states are recorded differently.
Note abandon is a delete where all resources have been set to a RETAIN deletion policy, but we also don’t want to delete anything required for those resources, e.g the stack_user_project.
Remove all snapshots for this stack.
Remove a snapshot from the backends.
- property dependencies¶
Return a set of resource IDs that are dependent on another.
Given a resource ID, return a set of all other resource IDs that are dependent on that one - that is to say, those that must be cleaned up before the given resource is cleaned up.
- property env¶
The stack environment
- get_kwargs_for_cloning(keep_status=False, only_db=False, keep_tags=False)¶
Get common kwargs for calling Stack() for cloning.
The point of this method is to reduce the number of places that we need to update when a kwarg to Stack.__init__() is modified. It is otherwise easy to forget an option and cause some unexpected error if this option is lost.
This doesn’t return the args(name, template) but only the kwargs.
We often want to start ‘fresh’ so don’t want to maintain the old status, action and status_reason.
We sometimes only want the DB attributes.
Return nested parameters schema, if any.
This introspects the resources to return the parameters of the nested stacks. It uses the get_nested_parameters_stack API to build the stack.
Returns True if this stack has timed-out.
Return an identifier for this stack.
- iter_resources(nested_depth=0, filters=None)¶
Iterates over all the resources in a stack.
Iterating includes nested stacks up to nested_depth levels below.
- classmethod load(context, stack_id=None, stack=None, show_deleted=True, use_stored_context=False, force_reload=False, cache_data=None, load_template=True, check_refresh_cred=False)¶
Retrieve a Stack from the database.
- classmethod load_all(context, limit=None, marker=None, sort_keys=None, sort_dir=None, filters=None, show_deleted=False, show_nested=False, show_hidden=False, tags=None, tags_any=None, not_tags=None, not_tags_any=None)¶
Mark the convergence update as complete.
Mark the convergence update as failed.
Return stack resources and stacks in path from the root stack.
If this is not nested return (None, self), else return stack resources and stacks in path from the root stack and including this stack.
Note that this is horribly inefficient, as it requires us to load every stack in the chain back to the root in memory at the same time.
a list of (stack_resource, stack) tuples.
- property outputs¶
- property parameters¶
- property parent_resource¶
Dynamically load up the parent_resource.
Note: this should only be used by “Fn::ResourceFacade”
- property parent_resource_name¶
Return tuples of names in path from the root stack.
If this is not nested return (None, self.name), else return tuples of names (stack_resource.name, stack.name) in path from the root stack and including this stack.
a list of (string, string) tuples.
Persist stack state to database and release stack lock
Preview the stack with all of the resources.
Cleanup database after stack has completed/failed.
Delete the resources from DB.
If the stack failed, update the current_traversal to empty string so that the resource workers bail out.
Delete previous raw template if stack completes successfully.
Deletes all sync points. They are no longer needed after stack has completed/failed.
Delete the stack if the action is DELETE.
- register_access_allowed_handler(credential_id, handler)¶
Register an authorization handler function.
Register a function which determines whether the credentials with a given ID can have access to a named resource.
Remove the resource with the specified name.
Determine whether to perform API requests with deferred auth.
Returns whether this stack may need to perform API requests during its lifecycle using the configured deferred authentication method.
Return the resource in this stack with the specified refid.
resource in this stack with the specified refid, or None if not found.
Return a stack resource, even if not in the current template.
- property resources¶
- restore(snapshot, notify=None)¶
Restore the given snapshot.
Invokes handle_restore on all resources.
Resume the stack.
Invokes handle_resume for all stack resources.
Waits for all resources to become RESUME_COMPLETE then declares the stack RESUME_COMPLETE. Note the default implementation for all resources is to do nothing other than move to RESUME_COMPLETE, so the resources must implement handle_resume for this to have any effect.
Snapshot the stack, invoking handle_snapshot on all resources.
- stack_task(action, reverse=False, post_func=None, aggregate_exceptions=False, pre_completion_func=None, notify=None)¶
A task to perform an action on the stack.
All of the resources are traversed in forward or reverse dependency order.
action – action that should be executed with stack resources
reverse – define if action on the resources need to be executed in reverse dependency order
post_func – function that need to be executed after action complete on the stack
aggregate_exceptions – define if exceptions should be aggregated
pre_completion_func – function that need to be executed right before action completion; uses stack, action, status and reason as input parameters
- property state¶
Returns state, tuple of action, status.
- state_set(action, status, reason)¶
Update the stack state.
- store(backup=False, exp_trvsl=None, ignore_traversal_check=False)¶
Store the stack in the database and return its ID.
If self.id is set, we update the existing stack.
Suspend the stack.
Invokes handle_suspend for all stack resources.
Waits for all resources to become SUSPEND_COMPLETE then declares the stack SUSPEND_COMPLETE. Note the default implementation for all resources is to do nothing other than move to SUSPEND_COMPLETE, so the resources must implement handle_suspend for this to have any effect.
- property t¶
The stack template.
Time elapsed in seconds since the stack operation started.
Time left before stack times out.
Return the stack action timeout in seconds.
Return the total number of resources in a stack.
Includes nested stacks below.
- update(newstack, msg_queue=None, notify=None)¶
Update the stack.
Compare the current stack with newstack, and where necessary create/update/delete the resources until this stack aligns with newstack.
Note update of existing stack resources depends on update being implemented in the underlying resource types
Update will fail if it exceeds the specified timeout. The default is 60 minutes, set in the constructor
- update_task(newstack, action='UPDATE', msg_queue=None, notify=None)¶
- validate(ignorable_errors=None, validate_res_tmpl_only=False)¶
Validates the stack.
- property worker_client¶
Return a client for making engine RPC calls.