sceptre.plan package

class sceptre.plan.NullHandler(level=0)[source]

Bases: logging.Handler

emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

Submodules

sceptre.plan.actions module

sceptre.plan.actions

This module implements the StackActions class which provides the functionality available to a Stack.

class sceptre.plan.actions.StackActions(stack)[source]

Bases: object

StackActions stores the operations a Stack can take, such as creating or deleting the Stack.

Parameters

stack (sceptre.stack.Stack) – A Stack object

cancel_stack_update()[source]

Cancels a Stack update.

Returns

The cancelled Stack status.

Return type

sceptre.stack_status.StackStatus

continue_update_rollback()[source]

Rolls back a Stack in the UPDATE_ROLLBACK_FAILED state to UPDATE_ROLLBACK_COMPLETE.

create()[source]

Creates a Stack.

Returns

The Stack’s status.

Return type

sceptre.stack_status.StackStatus

create_change_set(change_set_name)[source]

Creates a Change Set with the name change_set_name.

Parameters

change_set_name (str) – The name of the Change Set.

delete()[source]

Deletes the Stack.

Returns

The Stack’s status.

Return type

sceptre.stack_status.StackStatus

delete_change_set(change_set_name)[source]

Deletes the Change Set change_set_name.

Parameters

change_set_name (str) – The name of the Change Set.

describe()[source]

Returns the a description of the Stack.

Returns

A Stack description.

Return type

dict

describe_change_set(change_set_name)[source]

Describes the Change Set change_set_name.

Parameters

change_set_name (str) – The name of the Change Set.

Returns

The description of the Change Set.

Return type

dict

describe_events()[source]

Returns the CloudFormation events for a Stack.

Returns

CloudFormation events for a Stack.

Return type

dict

describe_outputs()[source]

Returns the Stack’s outputs.

Returns

The Stack’s outputs.

Return type

list

describe_resources()[source]

Returns the logical and physical resource IDs of the Stack’s resources.

Returns

Information about the Stack’s resources.

Return type

dict

estimate_cost()[source]

Estimates a Stack’s cost.

Returns

An estimate of the Stack’s cost.

Return type

dict

Raises

botocore.exceptions.ClientError

execute_change_set(change_set_name)[source]

Executes the Change Set change_set_name.

Parameters

change_set_name (str) – The name of the Change Set.

Returns

The Stack status

Return type

str

generate()[source]

Returns the Template for the Stack

get_policy()[source]

Returns a Stack’s Policy.

Returns

The Stack’s Stack Policy.

Return type

str

get_status()[source]

Returns the Stack’s status.

Returns

The Stack’s status.

Return type

sceptre.stack_status.StackStatus

launch()[source]

Launches the Stack.

If the Stack status is create_failed or rollback_complete, the Stack is deleted. Launch then tries to create or update the Stack, depending if it already exists. If there are no updates to be performed, launch exits gracefully.

Returns

The Stack’s status.

Return type

sceptre.stack_status.StackStatus

list_change_sets()[source]

Lists the Stack’s Change Sets.

Returns

The Stack’s Change Sets.

Return type

dict or list

lock()[source]

Locks the Stack by applying a deny-all updates Stack Policy.

set_policy(policy_path)[source]

Applies a Stack Policy.

Parameters

policy_path (str) – The relative path of JSON file containing the AWS Policy to apply.

unlock()[source]

Unlocks the Stack by applying an allow-all updates Stack Policy.

update()[source]

Updates the Stack.

Returns

The Stack’s status.

Return type

sceptre.stack_status.StackStatus

validate()[source]

Validates the Stack’s CloudFormation Template.

Raises an error if the Template is invalid.

Returns

Validation information about the Template.

Return type

dict

Raises

botocore.exceptions.ClientError

wait_for_cs_completion(change_set_name)[source]

Waits while the Stack Change Set status is “pending”.

Parameters

change_set_name (str) – The name of the Change Set.

Returns

The Change Set’s status.

Return type

sceptre.stack_status.StackChangeSetStatus

sceptre.plan.executor module

sceptre.plan.executor

This module implements a SceptrePlanExecutor, which is responsible for executing the command specified in a SceptrePlan.

class sceptre.plan.executor.SceptrePlanExecutor(command, launch_order)[source]

Bases: object

execute(*args)[source]

Execute is responsible executing the sets of Stacks in launch_order concurrently, in the correct order.

Parameters

*args

Any arguments that should be passed through to the StackAction being called.

sceptre.plan.plan module

sceptre.plan.plan

This module implements a SceptrePlan, which is responsible for holding all nessessary information for a command to execute.

class sceptre.plan.plan.SceptrePlan(context)[source]

Bases: object

cancel_stack_update(*args)[source]

Cancels a Stack update.

Returns

A dictionary of Stacks and their cancelled statuses.

Return type

dict

continue_update_rollback(*args)[source]

Rolls back a Stack in the UPDATE_ROLLBACK_FAILED state to UPDATE_ROLLBACK_COMPLETE.

Returns

A dictionary of Stacks

Return type

dict

create(*args)[source]

Creates the Stack.

Returns

A dictionary of Stacks and their status.

Return type

dict

create_change_set(*args)[source]

Creates a Change Set with the name change_set_name.

Parameters

change_set_name (str) – The name of the Change Set.

Returns

A dictionary of Stacks

Return type

dict

delete(*args)[source]

Deletes the Stack.

Returns

A dictionary of Stacks and their status.

Return type

dict

delete_change_set(*args)[source]

Deletes the Change Set change_set_name.

Parameters

change_set_name (str) – The name of the Change Set.

Returns

A dictionary of Stacks

Return type

dict

describe(*args)[source]

Returns the a description of the Stack.

Returns

A dictionary of Stacks and their description.

Return type

dict

describe_change_set(*args)[source]

Describes the Change Set change_set_name.

Parameters

change_set_name (str) – The name of the Change Set.

Returns

A dictionary of Stacks and their Change Set description.

Return type

dict

describe_events(*args)[source]

Returns a dictionary contianing the Stack events.

Returns

A dictionary of Stacks and their CloudFormation events.

Return type

dict

describe_outputs(*args)[source]

Returns a list of Stack outputs.

Returns

A dictionary of Stacks and their outputs.

Return type

dict

describe_resources(*args)[source]

Returns the logical and physical resource IDs of the Stack’s resources.

Returns

A dictionary of Stacks and their resources.

Return type

dict

estimate_cost(*args)[source]

Estimates a Stack’s cost.

Returns

A dictionary of Stacks and their estimated costs.

Return type

dict

Raises

botocore.exceptions.ClientError

execute_change_set(*args)[source]

Executes the Change Set change_set_name.

Parameters

change_set_name (str) – The name of the Change Set.

Returns

A dictionary of Stacks and their status.

Return type

dict

generate(*args)[source]

Returns a generated Template for a given Stack

Returns

A dictionary of Stacks and their template body.

Return type

dict

get_policy(*args)[source]

Returns a Stack’s policy.

Returns

A dictionary of Stacks and their Stack policy.

Return type

dict

get_status(*args)[source]

Returns the Stack’s status.

Returns

A dictionary of Stacks and their status.

Return type

dict

Raises

sceptre.exceptions.StackDoesNotExistError

launch(*args)[source]

Launches the Stack.

If the Stack status is create_failed or rollback_complete, the Stack is deleted. Launch then tries to create or update the Stack, depending if it already exists. If there are no updates to be performed, launch exits gracefully.

Returns

A dictionary of Stacks and their status.

Return type

dict

list_change_sets(*args)[source]

Lists the Stack’s Change Sets.

Returns

TA dictionary of Stacks and their Change Sets.

Return type

dict

lock(*args)[source]

Locks the Stack by applying a deny all updates Stack policy.

Returns

A dictionary of Stacks

Return type

dict

resolve(command, reverse=False)[source]
set_policy(*args)[source]

Applies a Stack policy.

Parameters

policy_path (str) – the path of json file containing a aws policy

Returns

A dictionary of Stacks

Return type

dict

template(*args)[source]

Returns the CloudFormation Template used to create the Stack.

Returns

A dictionary of Stacks and their templates.

Return type

dict

unlock(*args)[source]

Unlocks the Stack by applying an allow all updates Stack policy.

Returns

A dictionary of Stacks

Return type

dict

update(*args)[source]

Updates the Stack.

Returns

A dictionary of Stacks and their status.

Return type

dict

validate(*args)[source]

Validates the Stack’s CloudFormation template.

Raises an error if the Template is invalid.

Returns

A dictionary of Stacks and their template validation information.

Return type

dict

Raises

botocore.exceptions.ClientError

wait_for_cs_completion(*args)[source]

Waits while the Stack Change Set status is “pending”.

Parameters

change_set_name (str) – The name of the Change Set.

Return type

dict

Return type

sceptre.stack_status.StackChangeSetStatus