sceptre.config package

class sceptre.config.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.config.graph module

sceptre.config.graph

This module implements a StackGraph, which is represented as a directed acyclic graph of a Stack’s dependencies.

class sceptre.config.graph.StackGraph(stacks)[source]

Bases: object

A Directed Acyclic Graph representing the relationship between a Stack and its dependencies. Responsible for initalising the graph based on a set of Stacks.

count_dependencies(stack)[source]

Returns the number of incoming edges a given Stack has in the StackGraph. The number of incoming edge also represents the number of Stacks that depend on the given Stack.

filtered(source_stacks, reverse=False)[source]
remove_stack(stack)[source]

Removes a Stack from the StackGraph. This operation will also remove all adjecent edges that represent a ‘depends on’ relationship with other Stacks.

sceptre.config.reader module

sceptre.config

This module implements a ConfigReader class, which is responsible for reading and constructing Stacks.

sceptre.config.reader.ConfigAttributes

alias of sceptre.config.reader.Attributes

class sceptre.config.reader.ConfigReader(context)[source]

Bases: object

Parses YAML configuration files and produces Stack objects.

Responsible for loading Resolvers and Hook classes and adding them as constructors to the PyYAML parser.

Parameters

context – A SceptreContext.

construct_stacks()[source]

Traverses the files under the command path. For each file encountered, a Stack is constructed using the correct config. Dependencies are traversed and a final set of Stacks is returned.

Returns

A set of Stacks.

Return type

set

read(rel_path, base_config=None)[source]

Reads in configuration from one or more YAML files within the Sceptre project folder.

Parameters
  • rel_path (str) – Relative path to config to read.

  • base_config (dict) – Base config to provide defaults.

Returns

Config read from config files.

Return type

dict

resolve_node_tag(loader, node)[source]
resolve_stacks(stack_map)[source]

Transforms map of Stacks into a set of Stacks, transforms dependencies from a list of Strings (stack names) to a list of Stacks.

Parameters

stack_map – Map of stacks, containing dependencies as list of Strings.

Returns

Set of stacks, containing dependencies as list of Stacks.

Return type

set

Raises

sceptre.exceptions.DependencyDoesNotExistError

sceptre.config.strategies module

sceptre.config.strategies

This module contains the implementations of the strategies used to merge config attributes.

sceptre.config.strategies.child_wins(a, b)[source]

Always returns the second parameter.

Parameters
Returns

b

sceptre.config.strategies.dict_merge(a, b)[source]

Takes two dictionaries and merges them.

Parameters
  • a (dict) – A dictionary.

  • b (dict) – A dictionary.

Returns

A merged dict.

Return type

dict

sceptre.config.strategies.list_join(a, b)[source]

Takes two lists and joins them.

Parameters
  • a (list) – A list.

  • b (list) – A list.

Returns

A joined list from the two parameters.

Return type

list