stacker.config package

Module contents

class stacker.config.AnyType(required=False, default=Undefined, serialized_name=None, choices=None, validators=None, deserialize_from=None, export_level=None, serialize_when_none=None, messages=None, metadata=None)[source]

Bases: schematics.types.base.BaseType

MESSAGES = {u'choices': u'Value must be one of {0}.', u'required': u'This field is required.'}
class stacker.config.Config(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]

Bases: schematics.deprecated.Model

This is the Python representation of a stacker config file.

This is used internally by stacker to parse and validate a yaml formatted stacker configuration file, but can also be used in scripts to generate a stacker config file before handing it off to stacker to build/destroy.

Example:

from stacker.config import dump, Config, Stack

vpc = Stack({
    "name": "vpc",
    "class_path": "blueprints.VPC"})

config = Config()
config.namespace = "prod"
config.stacks = [vpc]

print dump(config)
lookups = <DictType(StringType) instance on Config as 'lookups'>
mappings = <DictType(DictType) instance on Config as 'mappings'>
namespace = <StringType() instance on Config as 'namespace'>
namespace_delimiter = <StringType() instance on Config as 'namespace_delimiter'>
package_sources = <ModelType(PackageSources) instance on Config as 'package_sources'>
post_build = <ListType(ModelType) instance on Config as 'post_build'>
post_destroy = <ListType(ModelType) instance on Config as 'post_destroy'>
pre_build = <ListType(ModelType) instance on Config as 'pre_build'>
pre_destroy = <ListType(ModelType) instance on Config as 'pre_destroy'>
service_role = <StringType() instance on Config as 'service_role'>
stacker_bucket = <StringType() instance on Config as 'stacker_bucket'>
stacker_bucket_region = <StringType() instance on Config as 'stacker_bucket_region'>
stacker_cache_dir = <StringType() instance on Config as 'stacker_cache_dir'>
stacks = <ListType(ModelType) instance on Config as 'stacks'>
sys_path = <StringType() instance on Config as 'sys_path'>
tags = <DictType(StringType) instance on Config as 'tags'>
targets = <ListType(ModelType) instance on Config as 'targets'>
template_indent = <StringType() instance on Config as 'template_indent'>
validate(*args, **kwargs)[source]
validate_stacks(data, value)[source]
class stacker.config.GitPackageSource(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]

Bases: schematics.deprecated.Model

branch = <StringType() instance on GitPackageSource as 'branch'>
commit = <StringType() instance on GitPackageSource as 'commit'>
configs = <ListType(StringType) instance on GitPackageSource as 'configs'>
paths = <ListType(StringType) instance on GitPackageSource as 'paths'>
tag = <StringType() instance on GitPackageSource as 'tag'>
uri = <StringType() instance on GitPackageSource as 'uri'>
class stacker.config.Hook(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]

Bases: schematics.deprecated.Model

args = <DictType(AnyType) instance on Hook as 'args'>
data_key = <StringType() instance on Hook as 'data_key'>
enabled = <BooleanType() instance on Hook as 'enabled'>
path = <StringType() instance on Hook as 'path'>
required = <BooleanType() instance on Hook as 'required'>
class stacker.config.LocalPackageSource(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]

Bases: schematics.deprecated.Model

configs = <ListType(StringType) instance on LocalPackageSource as 'configs'>
paths = <ListType(StringType) instance on LocalPackageSource as 'paths'>
source = <StringType() instance on LocalPackageSource as 'source'>
class stacker.config.PackageSources(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]

Bases: schematics.deprecated.Model

git = <ListType(ModelType) instance on PackageSources as 'git'>
local = <ListType(ModelType) instance on PackageSources as 'local'>
s3 = <ListType(ModelType) instance on PackageSources as 's3'>
class stacker.config.S3PackageSource(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]

Bases: schematics.deprecated.Model

bucket = <StringType() instance on S3PackageSource as 'bucket'>
configs = <ListType(StringType) instance on S3PackageSource as 'configs'>
key = <StringType() instance on S3PackageSource as 'key'>
paths = <ListType(StringType) instance on S3PackageSource as 'paths'>
requester_pays = <BooleanType() instance on S3PackageSource as 'requester_pays'>
use_latest = <BooleanType() instance on S3PackageSource as 'use_latest'>
class stacker.config.Stack(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]

Bases: schematics.deprecated.Model

class_path = <StringType() instance on Stack as 'class_path'>
description = <StringType() instance on Stack as 'description'>
enabled = <BooleanType() instance on Stack as 'enabled'>
in_progress_behavior = <StringType() instance on Stack as 'in_progress_behavior'>
locked = <BooleanType() instance on Stack as 'locked'>
name = <StringType() instance on Stack as 'name'>
parameters = <DictType(AnyType) instance on Stack as 'parameters'>
profile = <StringType() instance on Stack as 'profile'>
protected = <BooleanType() instance on Stack as 'protected'>
region = <StringType() instance on Stack as 'region'>
required_by = <ListType(StringType) instance on Stack as 'required_by'>
requires = <ListType(StringType) instance on Stack as 'requires'>
stack_name = <StringType() instance on Stack as 'stack_name'>
stack_policy_path = <StringType() instance on Stack as 'stack_policy_path'>
tags = <DictType(StringType) instance on Stack as 'tags'>
template_path = <StringType() instance on Stack as 'template_path'>
validate_class_path(data, value)[source]
validate_parameters(data, value)[source]
validate_stack_source(data)[source]
validate_template_path(data, value)[source]
variables = <DictType(AnyType) instance on Stack as 'variables'>
class stacker.config.Target(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]

Bases: schematics.deprecated.Model

name = <StringType() instance on Target as 'name'>
required_by = <ListType(StringType) instance on Target as 'required_by'>
requires = <ListType(StringType) instance on Target as 'requires'>
stacker.config.dump(config)[source]

Dumps a stacker Config object as yaml.

Parameters:
  • config (Config) – the stacker Config object.
  • stream (stream) – an optional stream object to write to.
Returns:

the yaml formatted stacker Config.

Return type:

str

stacker.config.load(config)[source]

Loads a stacker configuration by modifying sys paths, loading lookups, etc.

Parameters:config (Config) – the stacker config to load.
Returns:the stacker config provided above.
Return type:Config
stacker.config.not_empty_list(value)[source]
stacker.config.parse(raw_config)[source]

Parse a raw yaml formatted stacker config.

Parameters:raw_config (str) – the raw stacker configuration string in yaml format.
Returns:the parsed stacker config.
Return type:Config
stacker.config.process_remote_sources(raw_config, environment=None)[source]

Stage remote package sources and merge in remote configs.

Parameters:
  • raw_config (str) – the raw stacker configuration string.
  • environment (dict, optional) – any environment values that should be passed to the config
Returns:

the raw stacker configuration string

Return type:

str

stacker.config.render(raw_config, environment=None)[source]

Renders a config, using it as a template with the environment.

Parameters:
  • raw_config (str) – the raw stacker configuration string.
  • environment (dict, optional) – any environment values that should be passed to the config
Returns:

the stacker configuration populated with any values passed from

the environment

Return type:

str

stacker.config.render_parse_load(raw_config, environment=None, validate=True)[source]

Encapsulates the render -> parse -> validate -> load process.

Parameters:
  • raw_config (str) – the raw stacker configuration string.
  • environment (dict, optional) – any environment values that should be passed to the config
  • validate (bool) – if provided, the config is validated before being loaded.
Returns:

the parsed stacker config.

Return type:

Config