sceptre.hooks package

class sceptre.hooks.Hook(argument=None, stack=None)[source]

Bases: CustomYamlTagBase

Hook is an abstract base class that should be subclassed by all hooks.

logger = <Logger sceptre.hooks (WARNING)>
abstract run()[source]

run is an abstract method which must be overwritten by all inheriting classes. Run should execute the logic of the hook.

class sceptre.hooks.HookProperty(name)[source]

Bases: object

This is a descriptor class used to store an attribute that may contain Hook objects. Used to setup Hooks when added as a attribute. Supports nested dictionary and lists.


name (str) – Attribute suffix used to store the property in the instance.


A function decorator to trigger the before and after hooks, relative to the decorated function’s name. :param func: a function that operates on a stack :type func: function


Returns a decorator to trigger the before and after hooks, relative to the decorated function’s name AS WELL AS the passed function alias names. :type function_aliases: List[str] :param function_aliases: The list of OTHER functions to trigger hooks around. :return: The hook-triggering decorator.


Searches through dictionary or list for Resolver objects and replaces them with the resolved value. Supports nested dictionaries and lists. Does not detect Resolver objects used as keys in dictionaries.


attr (dict or list) – A complex data structure to search through.


A complex data structure without Resolver objects.

Return type

dict or list


sceptre.hooks.asg_scaling_processes module

class sceptre.hooks.asg_scaling_processes.ASGScalingProcesses(*args, **kwargs)[source]

Bases: Hook

Resumes or suspends autoscaling group scaling processes. This is useful as scheduled actions must be suspended when updating stacks with autoscaling groups.


Either suspends or resumes any scaling processes on all autoscaling groups within the current stack.


InvalidHookArgumentSyntaxError, when syntax is not using “::”.


InvalidHookArgumentTypeError, if argument is not a string.


InvalidHookArgumentValueError, if not using resume or suspend.

sceptre.hooks.cmd module

class sceptre.hooks.cmd.Cmd(*args, **kwargs)[source]

Bases: Hook

Cmd implements a Sceptre hook which can run arbitrary commands.


Executes a command through the shell.

See hooks documentation for details.


sceptre.exceptions.InvalidHookArgumentTypeError invalid input


CalledProcessError failed command


FileNotFoundError missing shell


PermissionError non-executable shell