repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
cloudtools/stacker | stacker/hooks/ecs.py | create_clusters | def create_clusters(provider, context, **kwargs):
"""Creates ECS clusters.
Expects a "clusters" argument, which should contain a list of cluster
names to create.
Args:
provider (:class:`stacker.providers.base.BaseProvider`): provider
instance
context (:class:`stacker.contex... | python | def create_clusters(provider, context, **kwargs):
"""Creates ECS clusters.
Expects a "clusters" argument, which should contain a list of cluster
names to create.
Args:
provider (:class:`stacker.providers.base.BaseProvider`): provider
instance
context (:class:`stacker.contex... | [
"def",
"create_clusters",
"(",
"provider",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"get_session",
"(",
"provider",
".",
"region",
")",
".",
"client",
"(",
"'ecs'",
")",
"try",
":",
"clusters",
"=",
"kwargs",
"[",
"\"clusters\"",
... | Creates ECS clusters.
Expects a "clusters" argument, which should contain a list of cluster
names to create.
Args:
provider (:class:`stacker.providers.base.BaseProvider`): provider
instance
context (:class:`stacker.context.Context`): context instance
Returns: boolean for w... | [
"Creates",
"ECS",
"clusters",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/hooks/ecs.py#L15-L45 | train |
cloudtools/stacker | stacker/blueprints/base.py | build_parameter | def build_parameter(name, properties):
"""Builds a troposphere Parameter with the given properties.
Args:
name (string): The name of the parameter.
properties (dict): Contains the properties that will be applied to the
parameter. See:
http://docs.aws.amazon.com/AWSCloudF... | python | def build_parameter(name, properties):
"""Builds a troposphere Parameter with the given properties.
Args:
name (string): The name of the parameter.
properties (dict): Contains the properties that will be applied to the
parameter. See:
http://docs.aws.amazon.com/AWSCloudF... | [
"def",
"build_parameter",
"(",
"name",
",",
"properties",
")",
":",
"p",
"=",
"Parameter",
"(",
"name",
",",
"Type",
"=",
"properties",
".",
"get",
"(",
"\"type\"",
")",
")",
"for",
"name",
",",
"attr",
"in",
"PARAMETER_PROPERTIES",
".",
"items",
"(",
... | Builds a troposphere Parameter with the given properties.
Args:
name (string): The name of the parameter.
properties (dict): Contains the properties that will be applied to the
parameter. See:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-s... | [
"Builds",
"a",
"troposphere",
"Parameter",
"with",
"the",
"given",
"properties",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L98-L114 | train |
cloudtools/stacker | stacker/blueprints/base.py | validate_variable_type | def validate_variable_type(var_name, var_type, value):
"""Ensures the value is the correct variable type.
Args:
var_name (str): The name of the defined variable on a blueprint.
var_type (type): The type that the value should be.
value (obj): The object representing the value provided fo... | python | def validate_variable_type(var_name, var_type, value):
"""Ensures the value is the correct variable type.
Args:
var_name (str): The name of the defined variable on a blueprint.
var_type (type): The type that the value should be.
value (obj): The object representing the value provided fo... | [
"def",
"validate_variable_type",
"(",
"var_name",
",",
"var_type",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"var_type",
",",
"CFNType",
")",
":",
"value",
"=",
"CFNParameter",
"(",
"name",
"=",
"var_name",
",",
"value",
"=",
"value",
")",
"elif",
... | Ensures the value is the correct variable type.
Args:
var_name (str): The name of the defined variable on a blueprint.
var_type (type): The type that the value should be.
value (obj): The object representing the value provided for the
variable
Returns:
object: Retur... | [
"Ensures",
"the",
"value",
"is",
"the",
"correct",
"variable",
"type",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L117-L150 | train |
cloudtools/stacker | stacker/blueprints/base.py | validate_allowed_values | def validate_allowed_values(allowed_values, value):
"""Support a variable defining which values it allows.
Args:
allowed_values (Optional[list]): A list of allowed values from the
variable definition
value (obj): The object representing the value provided for the
variabl... | python | def validate_allowed_values(allowed_values, value):
"""Support a variable defining which values it allows.
Args:
allowed_values (Optional[list]): A list of allowed values from the
variable definition
value (obj): The object representing the value provided for the
variabl... | [
"def",
"validate_allowed_values",
"(",
"allowed_values",
",",
"value",
")",
":",
"# ignore CFNParameter, troposphere handles these for us",
"if",
"not",
"allowed_values",
"or",
"isinstance",
"(",
"value",
",",
"CFNParameter",
")",
":",
"return",
"True",
"return",
"value... | Support a variable defining which values it allows.
Args:
allowed_values (Optional[list]): A list of allowed values from the
variable definition
value (obj): The object representing the value provided for the
variable
Returns:
bool: Boolean for whether or not th... | [
"Support",
"a",
"variable",
"defining",
"which",
"values",
"it",
"allows",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L153-L170 | train |
cloudtools/stacker | stacker/blueprints/base.py | parse_user_data | def parse_user_data(variables, raw_user_data, blueprint_name):
"""Parse the given user data and renders it as a template
It supports referencing template variables to create userdata
that's supplemented with information from the stack, as commonly
required when creating EC2 userdata files.
For exa... | python | def parse_user_data(variables, raw_user_data, blueprint_name):
"""Parse the given user data and renders it as a template
It supports referencing template variables to create userdata
that's supplemented with information from the stack, as commonly
required when creating EC2 userdata files.
For exa... | [
"def",
"parse_user_data",
"(",
"variables",
",",
"raw_user_data",
",",
"blueprint_name",
")",
":",
"variable_values",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"variables",
".",
"items",
"(",
")",
":",
"if",
"type",
"(",
"value",
")",
"is",
"CFNPa... | Parse the given user data and renders it as a template
It supports referencing template variables to create userdata
that's supplemented with information from the stack, as commonly
required when creating EC2 userdata files.
For example:
Given a raw_user_data string: 'open file ${file}'
... | [
"Parse",
"the",
"given",
"user",
"data",
"and",
"renders",
"it",
"as",
"a",
"template"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L239-L287 | train |
cloudtools/stacker | stacker/blueprints/base.py | Blueprint.get_parameter_definitions | def get_parameter_definitions(self):
"""Get the parameter definitions to submit to CloudFormation.
Any variable definition whose `type` is an instance of `CFNType` will
be returned as a CloudFormation Parameter.
Returns:
dict: parameter definitions. Keys are parameter names... | python | def get_parameter_definitions(self):
"""Get the parameter definitions to submit to CloudFormation.
Any variable definition whose `type` is an instance of `CFNType` will
be returned as a CloudFormation Parameter.
Returns:
dict: parameter definitions. Keys are parameter names... | [
"def",
"get_parameter_definitions",
"(",
"self",
")",
":",
"output",
"=",
"{",
"}",
"for",
"var_name",
",",
"attrs",
"in",
"self",
".",
"defined_variables",
"(",
")",
".",
"items",
"(",
")",
":",
"var_type",
"=",
"attrs",
".",
"get",
"(",
"\"type\"",
"... | Get the parameter definitions to submit to CloudFormation.
Any variable definition whose `type` is an instance of `CFNType` will
be returned as a CloudFormation Parameter.
Returns:
dict: parameter definitions. Keys are parameter names, the values
are dicts containin... | [
"Get",
"the",
"parameter",
"definitions",
"to",
"submit",
"to",
"CloudFormation",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L321-L340 | train |
cloudtools/stacker | stacker/blueprints/base.py | Blueprint.get_required_parameter_definitions | def get_required_parameter_definitions(self):
"""Returns all template parameters that do not have a default value.
Returns:
dict: dict of required CloudFormation Parameters for the blueprint.
Will be a dictionary of <parameter name>: <parameter
attributes>.
... | python | def get_required_parameter_definitions(self):
"""Returns all template parameters that do not have a default value.
Returns:
dict: dict of required CloudFormation Parameters for the blueprint.
Will be a dictionary of <parameter name>: <parameter
attributes>.
... | [
"def",
"get_required_parameter_definitions",
"(",
"self",
")",
":",
"required",
"=",
"{",
"}",
"for",
"name",
",",
"attrs",
"in",
"self",
".",
"get_parameter_definitions",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"\"Default\"",
"not",
"in",
"attrs",
":... | Returns all template parameters that do not have a default value.
Returns:
dict: dict of required CloudFormation Parameters for the blueprint.
Will be a dictionary of <parameter name>: <parameter
attributes>. | [
"Returns",
"all",
"template",
"parameters",
"that",
"do",
"not",
"have",
"a",
"default",
"value",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L342-L355 | train |
cloudtools/stacker | stacker/blueprints/base.py | Blueprint.setup_parameters | def setup_parameters(self):
"""Add any CloudFormation parameters to the template"""
t = self.template
parameters = self.get_parameter_definitions()
if not parameters:
logger.debug("No parameters defined.")
return
for name, attrs in parameters.items():
... | python | def setup_parameters(self):
"""Add any CloudFormation parameters to the template"""
t = self.template
parameters = self.get_parameter_definitions()
if not parameters:
logger.debug("No parameters defined.")
return
for name, attrs in parameters.items():
... | [
"def",
"setup_parameters",
"(",
"self",
")",
":",
"t",
"=",
"self",
".",
"template",
"parameters",
"=",
"self",
".",
"get_parameter_definitions",
"(",
")",
"if",
"not",
"parameters",
":",
"logger",
".",
"debug",
"(",
"\"No parameters defined.\"",
")",
"return"... | Add any CloudFormation parameters to the template | [
"Add",
"any",
"CloudFormation",
"parameters",
"to",
"the",
"template"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L376-L387 | train |
cloudtools/stacker | stacker/blueprints/base.py | Blueprint.render_template | def render_template(self):
"""Render the Blueprint to a CloudFormation template"""
self.import_mappings()
self.create_template()
if self.description:
self.set_template_description(self.description)
self.setup_parameters()
rendered = self.template.to_json(inden... | python | def render_template(self):
"""Render the Blueprint to a CloudFormation template"""
self.import_mappings()
self.create_template()
if self.description:
self.set_template_description(self.description)
self.setup_parameters()
rendered = self.template.to_json(inden... | [
"def",
"render_template",
"(",
"self",
")",
":",
"self",
".",
"import_mappings",
"(",
")",
"self",
".",
"create_template",
"(",
")",
"if",
"self",
".",
"description",
":",
"self",
".",
"set_template_description",
"(",
"self",
".",
"description",
")",
"self",... | Render the Blueprint to a CloudFormation template | [
"Render",
"the",
"Blueprint",
"to",
"a",
"CloudFormation",
"template"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L469-L478 | train |
cloudtools/stacker | stacker/blueprints/base.py | Blueprint.to_json | def to_json(self, variables=None):
"""Render the blueprint and return the template in json form.
Args:
variables (dict):
Optional dictionary providing/overriding variable values.
Returns:
str: the rendered CFN JSON template
"""
variables... | python | def to_json(self, variables=None):
"""Render the blueprint and return the template in json form.
Args:
variables (dict):
Optional dictionary providing/overriding variable values.
Returns:
str: the rendered CFN JSON template
"""
variables... | [
"def",
"to_json",
"(",
"self",
",",
"variables",
"=",
"None",
")",
":",
"variables_to_resolve",
"=",
"[",
"]",
"if",
"variables",
":",
"for",
"key",
",",
"value",
"in",
"variables",
".",
"items",
"(",
")",
":",
"variables_to_resolve",
".",
"append",
"(",... | Render the blueprint and return the template in json form.
Args:
variables (dict):
Optional dictionary providing/overriding variable values.
Returns:
str: the rendered CFN JSON template | [
"Render",
"the",
"blueprint",
"and",
"return",
"the",
"template",
"in",
"json",
"form",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L480-L503 | train |
cloudtools/stacker | stacker/blueprints/base.py | Blueprint.read_user_data | def read_user_data(self, user_data_path):
"""Reads and parses a user_data file.
Args:
user_data_path (str):
path to the userdata file
Returns:
str: the parsed user data file
"""
raw_user_data = read_value_from_path(user_data_path)
... | python | def read_user_data(self, user_data_path):
"""Reads and parses a user_data file.
Args:
user_data_path (str):
path to the userdata file
Returns:
str: the parsed user data file
"""
raw_user_data = read_value_from_path(user_data_path)
... | [
"def",
"read_user_data",
"(",
"self",
",",
"user_data_path",
")",
":",
"raw_user_data",
"=",
"read_value_from_path",
"(",
"user_data_path",
")",
"variables",
"=",
"self",
".",
"get_variables",
"(",
")",
"return",
"parse_user_data",
"(",
"variables",
",",
"raw_user... | Reads and parses a user_data file.
Args:
user_data_path (str):
path to the userdata file
Returns:
str: the parsed user data file | [
"Reads",
"and",
"parses",
"a",
"user_data",
"file",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L505-L520 | train |
cloudtools/stacker | stacker/blueprints/base.py | Blueprint.add_output | def add_output(self, name, value):
"""Simple helper for adding outputs.
Args:
name (str): The name of the output to create.
value (str): The value to put in the output.
"""
self.template.add_output(Output(name, Value=value)) | python | def add_output(self, name, value):
"""Simple helper for adding outputs.
Args:
name (str): The name of the output to create.
value (str): The value to put in the output.
"""
self.template.add_output(Output(name, Value=value)) | [
"def",
"add_output",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"self",
".",
"template",
".",
"add_output",
"(",
"Output",
"(",
"name",
",",
"Value",
"=",
"value",
")",
")"
] | Simple helper for adding outputs.
Args:
name (str): The name of the output to create.
value (str): The value to put in the output. | [
"Simple",
"helper",
"for",
"adding",
"outputs",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/blueprints/base.py#L532-L539 | train |
cloudtools/stacker | stacker/logger/__init__.py | setup_logging | def setup_logging(verbosity, formats=None):
"""
Configure a proper logger based on verbosity and optional log formats.
Args:
verbosity (int): 0, 1, 2
formats (dict): Optional, looks for `info`, `color`, and `debug` keys
which may override the associated default log f... | python | def setup_logging(verbosity, formats=None):
"""
Configure a proper logger based on verbosity and optional log formats.
Args:
verbosity (int): 0, 1, 2
formats (dict): Optional, looks for `info`, `color`, and `debug` keys
which may override the associated default log f... | [
"def",
"setup_logging",
"(",
"verbosity",
",",
"formats",
"=",
"None",
")",
":",
"if",
"formats",
"is",
"None",
":",
"formats",
"=",
"{",
"}",
"log_level",
"=",
"logging",
".",
"INFO",
"log_format",
"=",
"formats",
".",
"get",
"(",
"\"info\"",
",",
"IN... | Configure a proper logger based on verbosity and optional log formats.
Args:
verbosity (int): 0, 1, 2
formats (dict): Optional, looks for `info`, `color`, and `debug` keys
which may override the associated default log formats. | [
"Configure",
"a",
"proper",
"logger",
"based",
"on",
"verbosity",
"and",
"optional",
"log",
"formats",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/logger/__init__.py#L24-L53 | train |
cloudtools/stacker | stacker/stack.py | _gather_variables | def _gather_variables(stack_def):
"""Merges context provided & stack defined variables.
If multiple stacks have a variable with the same name, we can specify the
value for a specific stack by passing in the variable name as: `<stack
name>::<variable name>`. This variable value will only be used for tha... | python | def _gather_variables(stack_def):
"""Merges context provided & stack defined variables.
If multiple stacks have a variable with the same name, we can specify the
value for a specific stack by passing in the variable name as: `<stack
name>::<variable name>`. This variable value will only be used for tha... | [
"def",
"_gather_variables",
"(",
"stack_def",
")",
":",
"variable_values",
"=",
"copy",
".",
"deepcopy",
"(",
"stack_def",
".",
"variables",
"or",
"{",
"}",
")",
"return",
"[",
"Variable",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"variable_... | Merges context provided & stack defined variables.
If multiple stacks have a variable with the same name, we can specify the
value for a specific stack by passing in the variable name as: `<stack
name>::<variable name>`. This variable value will only be used for that
specific stack.
Order of prece... | [
"Merges",
"context",
"provided",
"&",
"stack",
"defined",
"variables",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/stack.py#L16-L42 | train |
cloudtools/stacker | stacker/stack.py | Stack.tags | def tags(self):
"""Returns the tags that should be set on this stack. Includes both the
global tags, as well as any stack specific tags or overrides.
Returns:
dict: dictionary of tags
"""
tags = self.definition.tags or {}
return dict(self.context.tags, **ta... | python | def tags(self):
"""Returns the tags that should be set on this stack. Includes both the
global tags, as well as any stack specific tags or overrides.
Returns:
dict: dictionary of tags
"""
tags = self.definition.tags or {}
return dict(self.context.tags, **ta... | [
"def",
"tags",
"(",
"self",
")",
":",
"tags",
"=",
"self",
".",
"definition",
".",
"tags",
"or",
"{",
"}",
"return",
"dict",
"(",
"self",
".",
"context",
".",
"tags",
",",
"*",
"*",
"tags",
")"
] | Returns the tags that should be set on this stack. Includes both the
global tags, as well as any stack specific tags or overrides.
Returns:
dict: dictionary of tags | [
"Returns",
"the",
"tags",
"that",
"should",
"be",
"set",
"on",
"this",
"stack",
".",
"Includes",
"both",
"the",
"global",
"tags",
"as",
"well",
"as",
"any",
"stack",
"specific",
"tags",
"or",
"overrides",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/stack.py#L146-L156 | train |
cloudtools/stacker | stacker/stack.py | Stack.resolve | def resolve(self, context, provider):
"""Resolve the Stack variables.
This resolves the Stack variables and then prepares the Blueprint for
rendering by passing the resolved variables to the Blueprint.
Args:
context (:class:`stacker.context.Context`): stacker context
... | python | def resolve(self, context, provider):
"""Resolve the Stack variables.
This resolves the Stack variables and then prepares the Blueprint for
rendering by passing the resolved variables to the Blueprint.
Args:
context (:class:`stacker.context.Context`): stacker context
... | [
"def",
"resolve",
"(",
"self",
",",
"context",
",",
"provider",
")",
":",
"resolve_variables",
"(",
"self",
".",
"variables",
",",
"context",
",",
"provider",
")",
"self",
".",
"blueprint",
".",
"resolve_variables",
"(",
"self",
".",
"variables",
")"
] | Resolve the Stack variables.
This resolves the Stack variables and then prepares the Blueprint for
rendering by passing the resolved variables to the Blueprint.
Args:
context (:class:`stacker.context.Context`): stacker context
provider (:class:`stacker.provider.base.Bas... | [
"Resolve",
"the",
"Stack",
"variables",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/stack.py#L181-L194 | train |
cloudtools/stacker | stacker/lookups/handlers/file.py | _parameterize_string | def _parameterize_string(raw):
"""Substitute placeholders in a string using CloudFormation references
Args:
raw (`str`): String to be processed. Byte strings are not
supported; decode them before passing them to this function.
Returns:
`str` | :class:`troposphere.GenericHelperFn`: ... | python | def _parameterize_string(raw):
"""Substitute placeholders in a string using CloudFormation references
Args:
raw (`str`): String to be processed. Byte strings are not
supported; decode them before passing them to this function.
Returns:
`str` | :class:`troposphere.GenericHelperFn`: ... | [
"def",
"_parameterize_string",
"(",
"raw",
")",
":",
"parts",
"=",
"[",
"]",
"s_index",
"=",
"0",
"for",
"match",
"in",
"_PARAMETER_PATTERN",
".",
"finditer",
"(",
"raw",
")",
":",
"parts",
".",
"append",
"(",
"raw",
"[",
"s_index",
":",
"match",
".",
... | Substitute placeholders in a string using CloudFormation references
Args:
raw (`str`): String to be processed. Byte strings are not
supported; decode them before passing them to this function.
Returns:
`str` | :class:`troposphere.GenericHelperFn`: An expression with
placeho... | [
"Substitute",
"placeholders",
"in",
"a",
"string",
"using",
"CloudFormation",
"references"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/handlers/file.py#L119-L146 | train |
cloudtools/stacker | stacker/lookups/handlers/file.py | parameterized_codec | def parameterized_codec(raw, b64):
"""Parameterize a string, possibly encoding it as Base64 afterwards
Args:
raw (`str` | `bytes`): String to be processed. Byte strings will be
interpreted as UTF-8.
b64 (`bool`): Whether to wrap the output in a Base64 CloudFormation
call... | python | def parameterized_codec(raw, b64):
"""Parameterize a string, possibly encoding it as Base64 afterwards
Args:
raw (`str` | `bytes`): String to be processed. Byte strings will be
interpreted as UTF-8.
b64 (`bool`): Whether to wrap the output in a Base64 CloudFormation
call... | [
"def",
"parameterized_codec",
"(",
"raw",
",",
"b64",
")",
":",
"if",
"isinstance",
"(",
"raw",
",",
"bytes",
")",
":",
"raw",
"=",
"raw",
".",
"decode",
"(",
"'utf-8'",
")",
"result",
"=",
"_parameterize_string",
"(",
"raw",
")",
"# Note, since we want a ... | Parameterize a string, possibly encoding it as Base64 afterwards
Args:
raw (`str` | `bytes`): String to be processed. Byte strings will be
interpreted as UTF-8.
b64 (`bool`): Whether to wrap the output in a Base64 CloudFormation
call
Returns:
:class:`troposphere... | [
"Parameterize",
"a",
"string",
"possibly",
"encoding",
"it",
"as",
"Base64",
"afterwards"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/handlers/file.py#L149-L171 | train |
cloudtools/stacker | stacker/lookups/handlers/file.py | _parameterize_obj | def _parameterize_obj(obj):
"""Recursively parameterize all strings contained in an object.
Parameterizes all values of a Mapping, all items of a Sequence, an
unicode string, or pass other objects through unmodified.
Byte strings will be interpreted as UTF-8.
Args:
obj: data to parameteri... | python | def _parameterize_obj(obj):
"""Recursively parameterize all strings contained in an object.
Parameterizes all values of a Mapping, all items of a Sequence, an
unicode string, or pass other objects through unmodified.
Byte strings will be interpreted as UTF-8.
Args:
obj: data to parameteri... | [
"def",
"_parameterize_obj",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"Mapping",
")",
":",
"return",
"dict",
"(",
"(",
"key",
",",
"_parameterize_obj",
"(",
"value",
")",
")",
"for",
"key",
",",
"value",
"in",
"obj",
".",
"items",
"(... | Recursively parameterize all strings contained in an object.
Parameterizes all values of a Mapping, all items of a Sequence, an
unicode string, or pass other objects through unmodified.
Byte strings will be interpreted as UTF-8.
Args:
obj: data to parameterize
Return:
A parameter... | [
"Recursively",
"parameterize",
"all",
"strings",
"contained",
"in",
"an",
"object",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/handlers/file.py#L174-L201 | train |
cloudtools/stacker | stacker/lookups/handlers/file.py | FileLookup.handle | def handle(cls, value, **kwargs):
"""Translate a filename into the file contents.
Fields should use the following format::
<codec>:<path>
For example::
# We've written a file to /some/path:
$ echo "hello there" > /some/path
# In stacker we wou... | python | def handle(cls, value, **kwargs):
"""Translate a filename into the file contents.
Fields should use the following format::
<codec>:<path>
For example::
# We've written a file to /some/path:
$ echo "hello there" > /some/path
# In stacker we wou... | [
"def",
"handle",
"(",
"cls",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"codec",
",",
"path",
"=",
"value",
".",
"split",
"(",
"\":\"",
",",
"1",
")",
"except",
"ValueError",
":",
"raise",
"TypeError",
"(",
"\"File value must be of th... | Translate a filename into the file contents.
Fields should use the following format::
<codec>:<path>
For example::
# We've written a file to /some/path:
$ echo "hello there" > /some/path
# In stacker we would reference the contents of this file with t... | [
"Translate",
"a",
"filename",
"into",
"the",
"file",
"contents",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/handlers/file.py#L29-L116 | train |
cloudtools/stacker | stacker/lookups/handlers/envvar.py | EnvvarLookup.handle | def handle(cls, value, **kwargs):
"""Retrieve an environment variable.
For example:
# In stacker we would reference the environment variable like this:
conf_key: ${envvar ENV_VAR_NAME}
You can optionally store the value in a file, ie:
$ cat envvar_valu... | python | def handle(cls, value, **kwargs):
"""Retrieve an environment variable.
For example:
# In stacker we would reference the environment variable like this:
conf_key: ${envvar ENV_VAR_NAME}
You can optionally store the value in a file, ie:
$ cat envvar_valu... | [
"def",
"handle",
"(",
"cls",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"value",
"=",
"read_value_from_path",
"(",
"value",
")",
"try",
":",
"return",
"os",
".",
"environ",
"[",
"value",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
"(",... | Retrieve an environment variable.
For example:
# In stacker we would reference the environment variable like this:
conf_key: ${envvar ENV_VAR_NAME}
You can optionally store the value in a file, ie:
$ cat envvar_value.txt
ENV_VAR_NAME
a... | [
"Retrieve",
"an",
"environment",
"variable",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/handlers/envvar.py#L14-L40 | train |
cloudtools/stacker | stacker/providers/aws/default.py | ask_for_approval | def ask_for_approval(full_changeset=None, params_diff=None,
include_verbose=False):
"""Prompt the user for approval to execute a change set.
Args:
full_changeset (list, optional): A list of the full changeset that will
be output if the user specifies verbose.
pa... | python | def ask_for_approval(full_changeset=None, params_diff=None,
include_verbose=False):
"""Prompt the user for approval to execute a change set.
Args:
full_changeset (list, optional): A list of the full changeset that will
be output if the user specifies verbose.
pa... | [
"def",
"ask_for_approval",
"(",
"full_changeset",
"=",
"None",
",",
"params_diff",
"=",
"None",
",",
"include_verbose",
"=",
"False",
")",
":",
"approval_options",
"=",
"[",
"'y'",
",",
"'n'",
"]",
"if",
"include_verbose",
":",
"approval_options",
".",
"append... | Prompt the user for approval to execute a change set.
Args:
full_changeset (list, optional): A list of the full changeset that will
be output if the user specifies verbose.
params_diff (list, optional): A list of DictValue detailing the
differences between two parameters ret... | [
"Prompt",
"the",
"user",
"for",
"approval",
"to",
"execute",
"a",
"change",
"set",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L146-L181 | train |
cloudtools/stacker | stacker/providers/aws/default.py | output_summary | def output_summary(fqn, action, changeset, params_diff,
replacements_only=False):
"""Log a summary of the changeset.
Args:
fqn (string): fully qualified name of the stack
action (string): action to include in the log message
changeset (list): AWS changeset
par... | python | def output_summary(fqn, action, changeset, params_diff,
replacements_only=False):
"""Log a summary of the changeset.
Args:
fqn (string): fully qualified name of the stack
action (string): action to include in the log message
changeset (list): AWS changeset
par... | [
"def",
"output_summary",
"(",
"fqn",
",",
"action",
",",
"changeset",
",",
"params_diff",
",",
"replacements_only",
"=",
"False",
")",
":",
"replacements",
"=",
"[",
"]",
"changes",
"=",
"[",
"]",
"for",
"change",
"in",
"changeset",
":",
"resource",
"=",
... | Log a summary of the changeset.
Args:
fqn (string): fully qualified name of the stack
action (string): action to include in the log message
changeset (list): AWS changeset
params_diff (list): A list of dictionaries detailing the differences
between two parameters returne... | [
"Log",
"a",
"summary",
"of",
"the",
"changeset",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L184-L225 | train |
cloudtools/stacker | stacker/providers/aws/default.py | wait_till_change_set_complete | def wait_till_change_set_complete(cfn_client, change_set_id, try_count=25,
sleep_time=.5, max_sleep=3):
""" Checks state of a changeset, returning when it is in a complete state.
Since changesets can take a little bit of time to get into a complete
state, we need to poll i... | python | def wait_till_change_set_complete(cfn_client, change_set_id, try_count=25,
sleep_time=.5, max_sleep=3):
""" Checks state of a changeset, returning when it is in a complete state.
Since changesets can take a little bit of time to get into a complete
state, we need to poll i... | [
"def",
"wait_till_change_set_complete",
"(",
"cfn_client",
",",
"change_set_id",
",",
"try_count",
"=",
"25",
",",
"sleep_time",
"=",
".5",
",",
"max_sleep",
"=",
"3",
")",
":",
"complete",
"=",
"False",
"response",
"=",
"None",
"for",
"i",
"in",
"range",
... | Checks state of a changeset, returning when it is in a complete state.
Since changesets can take a little bit of time to get into a complete
state, we need to poll it until it does so. This will try to get the
state `try_count` times, waiting `sleep_time` * 2 seconds between each try
up to the `max_sle... | [
"Checks",
"state",
"of",
"a",
"changeset",
"returning",
"when",
"it",
"is",
"in",
"a",
"complete",
"state",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L256-L299 | train |
cloudtools/stacker | stacker/providers/aws/default.py | check_tags_contain | def check_tags_contain(actual, expected):
"""Check if a set of AWS resource tags is contained in another
Every tag key in `expected` must be present in `actual`, and have the same
value. Extra keys in `actual` but not in `expected` are ignored.
Args:
actual (list): Set of tags to be verified, ... | python | def check_tags_contain(actual, expected):
"""Check if a set of AWS resource tags is contained in another
Every tag key in `expected` must be present in `actual`, and have the same
value. Extra keys in `actual` but not in `expected` are ignored.
Args:
actual (list): Set of tags to be verified, ... | [
"def",
"check_tags_contain",
"(",
"actual",
",",
"expected",
")",
":",
"actual_set",
"=",
"set",
"(",
"(",
"item",
"[",
"\"Key\"",
"]",
",",
"item",
"[",
"\"Value\"",
"]",
")",
"for",
"item",
"in",
"actual",
")",
"expected_set",
"=",
"set",
"(",
"(",
... | Check if a set of AWS resource tags is contained in another
Every tag key in `expected` must be present in `actual`, and have the same
value. Extra keys in `actual` but not in `expected` are ignored.
Args:
actual (list): Set of tags to be verified, usually from the description
of a res... | [
"Check",
"if",
"a",
"set",
"of",
"AWS",
"resource",
"tags",
"is",
"contained",
"in",
"another"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L362-L379 | train |
cloudtools/stacker | stacker/providers/aws/default.py | generate_cloudformation_args | def generate_cloudformation_args(stack_name, parameters, tags, template,
capabilities=DEFAULT_CAPABILITIES,
change_set_type=None,
service_role=None,
stack_policy=None,
... | python | def generate_cloudformation_args(stack_name, parameters, tags, template,
capabilities=DEFAULT_CAPABILITIES,
change_set_type=None,
service_role=None,
stack_policy=None,
... | [
"def",
"generate_cloudformation_args",
"(",
"stack_name",
",",
"parameters",
",",
"tags",
",",
"template",
",",
"capabilities",
"=",
"DEFAULT_CAPABILITIES",
",",
"change_set_type",
"=",
"None",
",",
"service_role",
"=",
"None",
",",
"stack_policy",
"=",
"None",
",... | Used to generate the args for common cloudformation API interactions.
This is used for create_stack/update_stack/create_change_set calls in
cloudformation.
Args:
stack_name (str): The fully qualified stack name in Cloudformation.
parameters (list): A list of dictionaries that defines the
... | [
"Used",
"to",
"generate",
"the",
"args",
"for",
"common",
"cloudformation",
"API",
"interactions",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L382-L442 | train |
cloudtools/stacker | stacker/providers/aws/default.py | generate_stack_policy_args | def generate_stack_policy_args(stack_policy=None):
""" Converts a stack policy object into keyword args.
Args:
stack_policy (:class:`stacker.providers.base.Template`): A template
object representing a stack policy.
Returns:
dict: A dictionary of keyword arguments to be used els... | python | def generate_stack_policy_args(stack_policy=None):
""" Converts a stack policy object into keyword args.
Args:
stack_policy (:class:`stacker.providers.base.Template`): A template
object representing a stack policy.
Returns:
dict: A dictionary of keyword arguments to be used els... | [
"def",
"generate_stack_policy_args",
"(",
"stack_policy",
"=",
"None",
")",
":",
"args",
"=",
"{",
"}",
"if",
"stack_policy",
":",
"logger",
".",
"debug",
"(",
"\"Stack has a stack policy\"",
")",
"if",
"stack_policy",
".",
"url",
":",
"# stacker currently does no... | Converts a stack policy object into keyword args.
Args:
stack_policy (:class:`stacker.providers.base.Template`): A template
object representing a stack policy.
Returns:
dict: A dictionary of keyword arguments to be used elsewhere. | [
"Converts",
"a",
"stack",
"policy",
"object",
"into",
"keyword",
"args",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L445-L469 | train |
cloudtools/stacker | stacker/providers/aws/default.py | ProviderBuilder.build | def build(self, region=None, profile=None):
"""Get or create the provider for the given region and profile."""
with self.lock:
# memoization lookup key derived from region + profile.
key = "{}-{}".format(profile, region)
try:
# assume provider is in p... | python | def build(self, region=None, profile=None):
"""Get or create the provider for the given region and profile."""
with self.lock:
# memoization lookup key derived from region + profile.
key = "{}-{}".format(profile, region)
try:
# assume provider is in p... | [
"def",
"build",
"(",
"self",
",",
"region",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"with",
"self",
".",
"lock",
":",
"# memoization lookup key derived from region + profile.",
"key",
"=",
"\"{}-{}\"",
".",
"format",
"(",
"profile",
",",
"region",
... | Get or create the provider for the given region and profile. | [
"Get",
"or",
"create",
"the",
"provider",
"for",
"the",
"given",
"region",
"and",
"profile",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L481-L503 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.get_rollback_status_reason | def get_rollback_status_reason(self, stack_name):
"""Process events and returns latest roll back reason"""
event = next((item for item in self.get_events(stack_name,
False) if item["ResourceStatus"] ==
"UPDATE_ROLLBACK_IN_PROGRESS"), None)
if event:
... | python | def get_rollback_status_reason(self, stack_name):
"""Process events and returns latest roll back reason"""
event = next((item for item in self.get_events(stack_name,
False) if item["ResourceStatus"] ==
"UPDATE_ROLLBACK_IN_PROGRESS"), None)
if event:
... | [
"def",
"get_rollback_status_reason",
"(",
"self",
",",
"stack_name",
")",
":",
"event",
"=",
"next",
"(",
"(",
"item",
"for",
"item",
"in",
"self",
".",
"get_events",
"(",
"stack_name",
",",
"False",
")",
"if",
"item",
"[",
"\"ResourceStatus\"",
"]",
"==",... | Process events and returns latest roll back reason | [
"Process",
"events",
"and",
"returns",
"latest",
"roll",
"back",
"reason"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L650-L663 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.create_stack | def create_stack(self, fqn, template, parameters, tags,
force_change_set=False, stack_policy=None,
**kwargs):
"""Create a new Cloudformation stack.
Args:
fqn (str): The fully qualified name of the Cloudformation stack.
template (:class:`... | python | def create_stack(self, fqn, template, parameters, tags,
force_change_set=False, stack_policy=None,
**kwargs):
"""Create a new Cloudformation stack.
Args:
fqn (str): The fully qualified name of the Cloudformation stack.
template (:class:`... | [
"def",
"create_stack",
"(",
"self",
",",
"fqn",
",",
"template",
",",
"parameters",
",",
"tags",
",",
"force_change_set",
"=",
"False",
",",
"stack_policy",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"Attempting to creat... | Create a new Cloudformation stack.
Args:
fqn (str): The fully qualified name of the Cloudformation stack.
template (:class:`stacker.providers.base.Template`): A Template
object to use when creating the stack.
parameters (list): A list of dictionaries that def... | [
"Create",
"a",
"new",
"Cloudformation",
"stack",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L696-L751 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.select_update_method | def select_update_method(self, force_interactive, force_change_set):
"""Select the correct update method when updating a stack.
Args:
force_interactive (str): Whether or not to force interactive mode
no matter what mode the provider is in.
force_change_set (bool)... | python | def select_update_method(self, force_interactive, force_change_set):
"""Select the correct update method when updating a stack.
Args:
force_interactive (str): Whether or not to force interactive mode
no matter what mode the provider is in.
force_change_set (bool)... | [
"def",
"select_update_method",
"(",
"self",
",",
"force_interactive",
",",
"force_change_set",
")",
":",
"if",
"self",
".",
"interactive",
"or",
"force_interactive",
":",
"return",
"self",
".",
"interactive_update_stack",
"elif",
"force_change_set",
":",
"return",
"... | Select the correct update method when updating a stack.
Args:
force_interactive (str): Whether or not to force interactive mode
no matter what mode the provider is in.
force_change_set (bool): Whether or not to force change set use.
Returns:
function... | [
"Select",
"the",
"correct",
"update",
"method",
"when",
"updating",
"a",
"stack",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L753-L769 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.prepare_stack_for_update | def prepare_stack_for_update(self, stack, tags):
"""Prepare a stack for updating
It may involve deleting the stack if is has failed it's initial
creation. The deletion is only allowed if:
- The stack contains all the tags configured in the current context;
- The stack is in ... | python | def prepare_stack_for_update(self, stack, tags):
"""Prepare a stack for updating
It may involve deleting the stack if is has failed it's initial
creation. The deletion is only allowed if:
- The stack contains all the tags configured in the current context;
- The stack is in ... | [
"def",
"prepare_stack_for_update",
"(",
"self",
",",
"stack",
",",
"tags",
")",
":",
"if",
"self",
".",
"is_stack_destroyed",
"(",
"stack",
")",
":",
"return",
"False",
"elif",
"self",
".",
"is_stack_completed",
"(",
"stack",
")",
":",
"return",
"True",
"s... | Prepare a stack for updating
It may involve deleting the stack if is has failed it's initial
creation. The deletion is only allowed if:
- The stack contains all the tags configured in the current context;
- The stack is in one of the statuses considered safe to re-create
-... | [
"Prepare",
"a",
"stack",
"for",
"updating"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L771-L836 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.update_stack | def update_stack(self, fqn, template, old_parameters, parameters, tags,
force_interactive=False, force_change_set=False,
stack_policy=None, **kwargs):
"""Update a Cloudformation stack.
Args:
fqn (str): The fully qualified name of the Cloudformation ... | python | def update_stack(self, fqn, template, old_parameters, parameters, tags,
force_interactive=False, force_change_set=False,
stack_policy=None, **kwargs):
"""Update a Cloudformation stack.
Args:
fqn (str): The fully qualified name of the Cloudformation ... | [
"def",
"update_stack",
"(",
"self",
",",
"fqn",
",",
"template",
",",
"old_parameters",
",",
"parameters",
",",
"tags",
",",
"force_interactive",
"=",
"False",
",",
"force_change_set",
"=",
"False",
",",
"stack_policy",
"=",
"None",
",",
"*",
"*",
"kwargs",
... | Update a Cloudformation stack.
Args:
fqn (str): The fully qualified name of the Cloudformation stack.
template (:class:`stacker.providers.base.Template`): A Template
object to use when updating the stack.
old_parameters (list): A list of dictionaries that def... | [
"Update",
"a",
"Cloudformation",
"stack",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L838-L873 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.deal_with_changeset_stack_policy | def deal_with_changeset_stack_policy(self, fqn, stack_policy):
""" Set a stack policy when using changesets.
ChangeSets don't allow you to set stack policies in the same call to
update them. This sets it before executing the changeset if the
stack policy is passed in.
Args:
... | python | def deal_with_changeset_stack_policy(self, fqn, stack_policy):
""" Set a stack policy when using changesets.
ChangeSets don't allow you to set stack policies in the same call to
update them. This sets it before executing the changeset if the
stack policy is passed in.
Args:
... | [
"def",
"deal_with_changeset_stack_policy",
"(",
"self",
",",
"fqn",
",",
"stack_policy",
")",
":",
"if",
"stack_policy",
":",
"kwargs",
"=",
"generate_stack_policy_args",
"(",
"stack_policy",
")",
"kwargs",
"[",
"\"StackName\"",
"]",
"=",
"fqn",
"logger",
".",
"... | Set a stack policy when using changesets.
ChangeSets don't allow you to set stack policies in the same call to
update them. This sets it before executing the changeset if the
stack policy is passed in.
Args:
stack_policy (:class:`stacker.providers.base.Template`): A templat... | [
"Set",
"a",
"stack",
"policy",
"when",
"using",
"changesets",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L875-L890 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.interactive_update_stack | def interactive_update_stack(self, fqn, template, old_parameters,
parameters, stack_policy, tags,
**kwargs):
"""Update a Cloudformation stack in interactive mode.
Args:
fqn (str): The fully qualified name of the Cloudformatio... | python | def interactive_update_stack(self, fqn, template, old_parameters,
parameters, stack_policy, tags,
**kwargs):
"""Update a Cloudformation stack in interactive mode.
Args:
fqn (str): The fully qualified name of the Cloudformatio... | [
"def",
"interactive_update_stack",
"(",
"self",
",",
"fqn",
",",
"template",
",",
"old_parameters",
",",
"parameters",
",",
"stack_policy",
",",
"tags",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"Using interactive provider mode for %s.\"",
... | Update a Cloudformation stack in interactive mode.
Args:
fqn (str): The fully qualified name of the Cloudformation stack.
template (:class:`stacker.providers.base.Template`): A Template
object to use when updating the stack.
old_parameters (list): A list of d... | [
"Update",
"a",
"Cloudformation",
"stack",
"in",
"interactive",
"mode",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L892-L949 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.noninteractive_changeset_update | def noninteractive_changeset_update(self, fqn, template, old_parameters,
parameters, stack_policy, tags,
**kwargs):
"""Update a Cloudformation stack using a change set.
This is required for stacks with a defined Transform (... | python | def noninteractive_changeset_update(self, fqn, template, old_parameters,
parameters, stack_policy, tags,
**kwargs):
"""Update a Cloudformation stack using a change set.
This is required for stacks with a defined Transform (... | [
"def",
"noninteractive_changeset_update",
"(",
"self",
",",
"fqn",
",",
"template",
",",
"old_parameters",
",",
"parameters",
",",
"stack_policy",
",",
"tags",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"Using noninterative changeset provide... | Update a Cloudformation stack using a change set.
This is required for stacks with a defined Transform (i.e. SAM), as the
default update_stack API cannot be used with them.
Args:
fqn (str): The fully qualified name of the Cloudformation stack.
template (:class:`stacker.... | [
"Update",
"a",
"Cloudformation",
"stack",
"using",
"a",
"change",
"set",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L951-L983 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.default_update_stack | def default_update_stack(self, fqn, template, old_parameters, parameters,
tags, stack_policy=None, **kwargs):
"""Update a Cloudformation stack in default mode.
Args:
fqn (str): The fully qualified name of the Cloudformation stack.
template (:class:`s... | python | def default_update_stack(self, fqn, template, old_parameters, parameters,
tags, stack_policy=None, **kwargs):
"""Update a Cloudformation stack in default mode.
Args:
fqn (str): The fully qualified name of the Cloudformation stack.
template (:class:`s... | [
"def",
"default_update_stack",
"(",
"self",
",",
"fqn",
",",
"template",
",",
"old_parameters",
",",
"parameters",
",",
"tags",
",",
"stack_policy",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"Using default provider mode for... | Update a Cloudformation stack in default mode.
Args:
fqn (str): The fully qualified name of the Cloudformation stack.
template (:class:`stacker.providers.base.Template`): A Template
object to use when updating the stack.
old_parameters (list): A list of dicti... | [
"Update",
"a",
"Cloudformation",
"stack",
"in",
"default",
"mode",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L985-L1027 | train |
cloudtools/stacker | stacker/providers/aws/default.py | Provider.get_stack_info | def get_stack_info(self, stack):
""" Get the template and parameters of the stack currently in AWS
Returns [ template, parameters ]
"""
stack_name = stack['StackId']
try:
template = self.cloudformation.get_template(
StackName=stack_name)['TemplateBod... | python | def get_stack_info(self, stack):
""" Get the template and parameters of the stack currently in AWS
Returns [ template, parameters ]
"""
stack_name = stack['StackId']
try:
template = self.cloudformation.get_template(
StackName=stack_name)['TemplateBod... | [
"def",
"get_stack_info",
"(",
"self",
",",
"stack",
")",
":",
"stack_name",
"=",
"stack",
"[",
"'StackId'",
"]",
"try",
":",
"template",
"=",
"self",
".",
"cloudformation",
".",
"get_template",
"(",
"StackName",
"=",
"stack_name",
")",
"[",
"'TemplateBody'",... | Get the template and parameters of the stack currently in AWS
Returns [ template, parameters ] | [
"Get",
"the",
"template",
"and",
"parameters",
"of",
"the",
"stack",
"currently",
"in",
"AWS"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/providers/aws/default.py#L1044-L1061 | train |
cloudtools/stacker | stacker/session_cache.py | get_session | def get_session(region, profile=None):
"""Creates a boto3 session with a cache
Args:
region (str): The region for the session
profile (str): The profile for the session
Returns:
:class:`boto3.session.Session`: A boto3 session with
credential caching
"""
if profi... | python | def get_session(region, profile=None):
"""Creates a boto3 session with a cache
Args:
region (str): The region for the session
profile (str): The profile for the session
Returns:
:class:`boto3.session.Session`: A boto3 session with
credential caching
"""
if profi... | [
"def",
"get_session",
"(",
"region",
",",
"profile",
"=",
"None",
")",
":",
"if",
"profile",
"is",
"None",
":",
"logger",
".",
"debug",
"(",
"\"No AWS profile explicitly provided. \"",
"\"Falling back to default.\"",
")",
"profile",
"=",
"default_profile",
"logger",... | Creates a boto3 session with a cache
Args:
region (str): The region for the session
profile (str): The profile for the session
Returns:
:class:`boto3.session.Session`: A boto3 session with
credential caching | [
"Creates",
"a",
"boto3",
"session",
"with",
"a",
"cache"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/session_cache.py#L20-L44 | train |
cloudtools/stacker | stacker/lookups/registry.py | register_lookup_handler | def register_lookup_handler(lookup_type, handler_or_path):
"""Register a lookup handler.
Args:
lookup_type (str): Name to register the handler under
handler_or_path (OneOf[func, str]): a function or a path to a handler
"""
handler = handler_or_path
if isinstance(handler_or_path, ba... | python | def register_lookup_handler(lookup_type, handler_or_path):
"""Register a lookup handler.
Args:
lookup_type (str): Name to register the handler under
handler_or_path (OneOf[func, str]): a function or a path to a handler
"""
handler = handler_or_path
if isinstance(handler_or_path, ba... | [
"def",
"register_lookup_handler",
"(",
"lookup_type",
",",
"handler_or_path",
")",
":",
"handler",
"=",
"handler_or_path",
"if",
"isinstance",
"(",
"handler_or_path",
",",
"basestring",
")",
":",
"handler",
"=",
"load_object_from_string",
"(",
"handler_or_path",
")",
... | Register a lookup handler.
Args:
lookup_type (str): Name to register the handler under
handler_or_path (OneOf[func, str]): a function or a path to a handler | [
"Register",
"a",
"lookup",
"handler",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/registry.py#L29-L53 | train |
cloudtools/stacker | stacker/lookups/registry.py | resolve_lookups | def resolve_lookups(variable, context, provider):
"""Resolve a set of lookups.
Args:
variable (:class:`stacker.variables.Variable`): The variable resolving
it's lookups.
context (:class:`stacker.context.Context`): stacker context
provider (:class:`stacker.provider.base.BaseP... | python | def resolve_lookups(variable, context, provider):
"""Resolve a set of lookups.
Args:
variable (:class:`stacker.variables.Variable`): The variable resolving
it's lookups.
context (:class:`stacker.context.Context`): stacker context
provider (:class:`stacker.provider.base.BaseP... | [
"def",
"resolve_lookups",
"(",
"variable",
",",
"context",
",",
"provider",
")",
":",
"resolved_lookups",
"=",
"{",
"}",
"for",
"lookup",
"in",
"variable",
".",
"lookups",
":",
"try",
":",
"handler",
"=",
"LOOKUP_HANDLERS",
"[",
"lookup",
".",
"type",
"]",... | Resolve a set of lookups.
Args:
variable (:class:`stacker.variables.Variable`): The variable resolving
it's lookups.
context (:class:`stacker.context.Context`): stacker context
provider (:class:`stacker.provider.base.BaseProvider`): subclass of the
base provider
... | [
"Resolve",
"a",
"set",
"of",
"lookups",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/registry.py#L69-L97 | train |
cloudtools/stacker | stacker/lookups/handlers/default.py | DefaultLookup.handle | def handle(cls, value, **kwargs):
"""Use a value from the environment or fall back to a default if the
environment doesn't contain the variable.
Format of value:
<env_var>::<default value>
For example:
Groups: ${default app_security_groups::sg-12345,sg-6789... | python | def handle(cls, value, **kwargs):
"""Use a value from the environment or fall back to a default if the
environment doesn't contain the variable.
Format of value:
<env_var>::<default value>
For example:
Groups: ${default app_security_groups::sg-12345,sg-6789... | [
"def",
"handle",
"(",
"cls",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"env_var_name",
",",
"default_val",
"=",
"value",
".",
"split",
"(",
"\"::\"",
",",
"1",
")",
"except",
"ValueError",
":",
"raise",
"ValueError",
"(",
"\"Invalid ... | Use a value from the environment or fall back to a default if the
environment doesn't contain the variable.
Format of value:
<env_var>::<default value>
For example:
Groups: ${default app_security_groups::sg-12345,sg-67890}
If `app_security_groups` is defin... | [
"Use",
"a",
"value",
"from",
"the",
"environment",
"or",
"fall",
"back",
"to",
"a",
"default",
"if",
"the",
"environment",
"doesn",
"t",
"contain",
"the",
"variable",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/handlers/default.py#L13-L41 | train |
cloudtools/stacker | stacker/lookups/__init__.py | extract_lookups_from_string | def extract_lookups_from_string(value):
"""Extract any lookups within a string.
Args:
value (str): string value we're extracting lookups from
Returns:
list: list of :class:`stacker.lookups.Lookup` if any
"""
lookups = set()
for match in LOOKUP_REGEX.finditer(value):
gr... | python | def extract_lookups_from_string(value):
"""Extract any lookups within a string.
Args:
value (str): string value we're extracting lookups from
Returns:
list: list of :class:`stacker.lookups.Lookup` if any
"""
lookups = set()
for match in LOOKUP_REGEX.finditer(value):
gr... | [
"def",
"extract_lookups_from_string",
"(",
"value",
")",
":",
"lookups",
"=",
"set",
"(",
")",
"for",
"match",
"in",
"LOOKUP_REGEX",
".",
"finditer",
"(",
"value",
")",
":",
"groupdict",
"=",
"match",
".",
"groupdict",
"(",
")",
"raw",
"=",
"match",
".",... | Extract any lookups within a string.
Args:
value (str): string value we're extracting lookups from
Returns:
list: list of :class:`stacker.lookups.Lookup` if any | [
"Extract",
"any",
"lookups",
"within",
"a",
"string",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/__init__.py#L29-L46 | train |
cloudtools/stacker | stacker/lookups/__init__.py | extract_lookups | def extract_lookups(value):
"""Recursively extracts any stack lookups within the data structure.
Args:
value (one of str, list, dict): a structure that contains lookups to
output values
Returns:
list: list of lookups if any
"""
lookups = set()
if isinstance(value, ... | python | def extract_lookups(value):
"""Recursively extracts any stack lookups within the data structure.
Args:
value (one of str, list, dict): a structure that contains lookups to
output values
Returns:
list: list of lookups if any
"""
lookups = set()
if isinstance(value, ... | [
"def",
"extract_lookups",
"(",
"value",
")",
":",
"lookups",
"=",
"set",
"(",
")",
"if",
"isinstance",
"(",
"value",
",",
"basestring",
")",
":",
"lookups",
"=",
"lookups",
".",
"union",
"(",
"extract_lookups_from_string",
"(",
"value",
")",
")",
"elif",
... | Recursively extracts any stack lookups within the data structure.
Args:
value (one of str, list, dict): a structure that contains lookups to
output values
Returns:
list: list of lookups if any | [
"Recursively",
"extracts",
"any",
"stack",
"lookups",
"within",
"the",
"data",
"structure",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/__init__.py#L49-L69 | train |
cloudtools/stacker | stacker/dag/__init__.py | DAG.add_node | def add_node(self, node_name):
""" Add a node if it does not exist yet, or error out.
Args:
node_name (str): The unique name of the node to add.
Raises:
KeyError: Raised if a node with the same name already exist in the
graph
"""
gr... | python | def add_node(self, node_name):
""" Add a node if it does not exist yet, or error out.
Args:
node_name (str): The unique name of the node to add.
Raises:
KeyError: Raised if a node with the same name already exist in the
graph
"""
gr... | [
"def",
"add_node",
"(",
"self",
",",
"node_name",
")",
":",
"graph",
"=",
"self",
".",
"graph",
"if",
"node_name",
"in",
"graph",
":",
"raise",
"KeyError",
"(",
"'node %s already exists'",
"%",
"node_name",
")",
"graph",
"[",
"node_name",
"]",
"=",
"set",
... | Add a node if it does not exist yet, or error out.
Args:
node_name (str): The unique name of the node to add.
Raises:
KeyError: Raised if a node with the same name already exist in the
graph | [
"Add",
"a",
"node",
"if",
"it",
"does",
"not",
"exist",
"yet",
"or",
"error",
"out",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/dag/__init__.py#L32-L45 | train |
cloudtools/stacker | stacker/dag/__init__.py | DAG.transpose | def transpose(self):
""" Builds a new graph with the edges reversed.
Returns:
:class:`stacker.dag.DAG`: The transposed graph.
"""
graph = self.graph
transposed = DAG()
for node, edges in graph.items():
transposed.add_node(node)
for node, e... | python | def transpose(self):
""" Builds a new graph with the edges reversed.
Returns:
:class:`stacker.dag.DAG`: The transposed graph.
"""
graph = self.graph
transposed = DAG()
for node, edges in graph.items():
transposed.add_node(node)
for node, e... | [
"def",
"transpose",
"(",
"self",
")",
":",
"graph",
"=",
"self",
".",
"graph",
"transposed",
"=",
"DAG",
"(",
")",
"for",
"node",
",",
"edges",
"in",
"graph",
".",
"items",
"(",
")",
":",
"transposed",
".",
"add_node",
"(",
"node",
")",
"for",
"nod... | Builds a new graph with the edges reversed.
Returns:
:class:`stacker.dag.DAG`: The transposed graph. | [
"Builds",
"a",
"new",
"graph",
"with",
"the",
"edges",
"reversed",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/dag/__init__.py#L136-L150 | train |
cloudtools/stacker | stacker/dag/__init__.py | DAG.walk | def walk(self, walk_func):
""" Walks each node of the graph in reverse topological order.
This can be used to perform a set of operations, where the next
operation depends on the previous operation. It's important to note
that walking happens serially, and is not paralellized.
A... | python | def walk(self, walk_func):
""" Walks each node of the graph in reverse topological order.
This can be used to perform a set of operations, where the next
operation depends on the previous operation. It's important to note
that walking happens serially, and is not paralellized.
A... | [
"def",
"walk",
"(",
"self",
",",
"walk_func",
")",
":",
"nodes",
"=",
"self",
".",
"topological_sort",
"(",
")",
"# Reverse so we start with nodes that have no dependencies.",
"nodes",
".",
"reverse",
"(",
")",
"for",
"n",
"in",
"nodes",
":",
"walk_func",
"(",
... | Walks each node of the graph in reverse topological order.
This can be used to perform a set of operations, where the next
operation depends on the previous operation. It's important to note
that walking happens serially, and is not paralellized.
Args:
walk_func (:class:`typ... | [
"Walks",
"each",
"node",
"of",
"the",
"graph",
"in",
"reverse",
"topological",
"order",
".",
"This",
"can",
"be",
"used",
"to",
"perform",
"a",
"set",
"of",
"operations",
"where",
"the",
"next",
"operation",
"depends",
"on",
"the",
"previous",
"operation",
... | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/dag/__init__.py#L152-L167 | train |
cloudtools/stacker | stacker/dag/__init__.py | DAG.transitive_reduction | def transitive_reduction(self):
""" Performs a transitive reduction on the DAG. The transitive
reduction of a graph is a graph with as few edges as possible with the
same reachability as the original graph.
See https://en.wikipedia.org/wiki/Transitive_reduction
"""
combi... | python | def transitive_reduction(self):
""" Performs a transitive reduction on the DAG. The transitive
reduction of a graph is a graph with as few edges as possible with the
same reachability as the original graph.
See https://en.wikipedia.org/wiki/Transitive_reduction
"""
combi... | [
"def",
"transitive_reduction",
"(",
"self",
")",
":",
"combinations",
"=",
"[",
"]",
"for",
"node",
",",
"edges",
"in",
"self",
".",
"graph",
".",
"items",
"(",
")",
":",
"combinations",
"+=",
"[",
"[",
"node",
",",
"edge",
"]",
"for",
"edge",
"in",
... | Performs a transitive reduction on the DAG. The transitive
reduction of a graph is a graph with as few edges as possible with the
same reachability as the original graph.
See https://en.wikipedia.org/wiki/Transitive_reduction | [
"Performs",
"a",
"transitive",
"reduction",
"on",
"the",
"DAG",
".",
"The",
"transitive",
"reduction",
"of",
"a",
"graph",
"is",
"a",
"graph",
"with",
"as",
"few",
"edges",
"as",
"possible",
"with",
"the",
"same",
"reachability",
"as",
"the",
"original",
"... | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/dag/__init__.py#L169-L196 | train |
cloudtools/stacker | stacker/dag/__init__.py | DAG.rename_edges | def rename_edges(self, old_node_name, new_node_name):
""" Change references to a node in existing edges.
Args:
old_node_name (str): The old name for the node.
new_node_name (str): The new name for the node.
"""
graph = self.graph
for node, edges in graph.... | python | def rename_edges(self, old_node_name, new_node_name):
""" Change references to a node in existing edges.
Args:
old_node_name (str): The old name for the node.
new_node_name (str): The new name for the node.
"""
graph = self.graph
for node, edges in graph.... | [
"def",
"rename_edges",
"(",
"self",
",",
"old_node_name",
",",
"new_node_name",
")",
":",
"graph",
"=",
"self",
".",
"graph",
"for",
"node",
",",
"edges",
"in",
"graph",
".",
"items",
"(",
")",
":",
"if",
"node",
"==",
"old_node_name",
":",
"graph",
"[... | Change references to a node in existing edges.
Args:
old_node_name (str): The old name for the node.
new_node_name (str): The new name for the node. | [
"Change",
"references",
"to",
"a",
"node",
"in",
"existing",
"edges",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/dag/__init__.py#L198-L214 | train |
cloudtools/stacker | stacker/dag/__init__.py | DAG.downstream | def downstream(self, node):
""" Returns a list of all nodes this node has edges towards.
Args:
node (str): The node whose downstream nodes you want to find.
Returns:
list: A list of nodes that are immediately downstream from the
node.
"""
... | python | def downstream(self, node):
""" Returns a list of all nodes this node has edges towards.
Args:
node (str): The node whose downstream nodes you want to find.
Returns:
list: A list of nodes that are immediately downstream from the
node.
"""
... | [
"def",
"downstream",
"(",
"self",
",",
"node",
")",
":",
"graph",
"=",
"self",
".",
"graph",
"if",
"node",
"not",
"in",
"graph",
":",
"raise",
"KeyError",
"(",
"'node %s is not in graph'",
"%",
"node",
")",
"return",
"list",
"(",
"graph",
"[",
"node",
... | Returns a list of all nodes this node has edges towards.
Args:
node (str): The node whose downstream nodes you want to find.
Returns:
list: A list of nodes that are immediately downstream from the
node. | [
"Returns",
"a",
"list",
"of",
"all",
"nodes",
"this",
"node",
"has",
"edges",
"towards",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/dag/__init__.py#L228-L241 | train |
cloudtools/stacker | stacker/dag/__init__.py | DAG.filter | def filter(self, nodes):
""" Returns a new DAG with only the given nodes and their
dependencies.
Args:
nodes (list): The nodes you are interested in.
Returns:
:class:`stacker.dag.DAG`: The filtered graph.
"""
filtered_dag = DAG()
# Add ... | python | def filter(self, nodes):
""" Returns a new DAG with only the given nodes and their
dependencies.
Args:
nodes (list): The nodes you are interested in.
Returns:
:class:`stacker.dag.DAG`: The filtered graph.
"""
filtered_dag = DAG()
# Add ... | [
"def",
"filter",
"(",
"self",
",",
"nodes",
")",
":",
"filtered_dag",
"=",
"DAG",
"(",
")",
"# Add only the nodes we need.",
"for",
"node",
"in",
"nodes",
":",
"filtered_dag",
".",
"add_node_if_not_exists",
"(",
"node",
")",
"for",
"edge",
"in",
"self",
".",... | Returns a new DAG with only the given nodes and their
dependencies.
Args:
nodes (list): The nodes you are interested in.
Returns:
:class:`stacker.dag.DAG`: The filtered graph. | [
"Returns",
"a",
"new",
"DAG",
"with",
"only",
"the",
"given",
"nodes",
"and",
"their",
"dependencies",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/dag/__init__.py#L268-L292 | train |
cloudtools/stacker | stacker/dag/__init__.py | DAG.topological_sort | def topological_sort(self):
""" Returns a topological ordering of the DAG.
Returns:
list: A list of topologically sorted nodes in the graph.
Raises:
ValueError: Raised if the graph is not acyclic.
"""
graph = self.graph
in_degree = {}
fo... | python | def topological_sort(self):
""" Returns a topological ordering of the DAG.
Returns:
list: A list of topologically sorted nodes in the graph.
Raises:
ValueError: Raised if the graph is not acyclic.
"""
graph = self.graph
in_degree = {}
fo... | [
"def",
"topological_sort",
"(",
"self",
")",
":",
"graph",
"=",
"self",
".",
"graph",
"in_degree",
"=",
"{",
"}",
"for",
"u",
"in",
"graph",
":",
"in_degree",
"[",
"u",
"]",
"=",
"0",
"for",
"u",
"in",
"graph",
":",
"for",
"v",
"in",
"graph",
"["... | Returns a topological ordering of the DAG.
Returns:
list: A list of topologically sorted nodes in the graph.
Raises:
ValueError: Raised if the graph is not acyclic. | [
"Returns",
"a",
"topological",
"ordering",
"of",
"the",
"DAG",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/dag/__init__.py#L351-L387 | train |
cloudtools/stacker | stacker/dag/__init__.py | ThreadedWalker.walk | def walk(self, dag, walk_func):
""" Walks each node of the graph, in parallel if it can.
The walk_func is only called when the nodes dependencies have been
satisfied
"""
# First, we'll topologically sort all of the nodes, with nodes that
# have no dependencies first. We ... | python | def walk(self, dag, walk_func):
""" Walks each node of the graph, in parallel if it can.
The walk_func is only called when the nodes dependencies have been
satisfied
"""
# First, we'll topologically sort all of the nodes, with nodes that
# have no dependencies first. We ... | [
"def",
"walk",
"(",
"self",
",",
"dag",
",",
"walk_func",
")",
":",
"# First, we'll topologically sort all of the nodes, with nodes that",
"# have no dependencies first. We do this to ensure that we don't call",
"# .join on a thread that hasn't yet been started.",
"#",
"# TODO(ejholmes):... | Walks each node of the graph, in parallel if it can.
The walk_func is only called when the nodes dependencies have been
satisfied | [
"Walks",
"each",
"node",
"of",
"the",
"graph",
"in",
"parallel",
"if",
"it",
"can",
".",
"The",
"walk_func",
"is",
"only",
"called",
"when",
"the",
"nodes",
"dependencies",
"have",
"been",
"satisfied"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/dag/__init__.py#L424-L480 | train |
cloudtools/stacker | stacker/tokenize_userdata.py | cf_tokenize | def cf_tokenize(s):
""" Parses UserData for Cloudformation helper functions.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/qu... | python | def cf_tokenize(s):
""" Parses UserData for Cloudformation helper functions.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/qu... | [
"def",
"cf_tokenize",
"(",
"s",
")",
":",
"t",
"=",
"[",
"]",
"parts",
"=",
"split_re",
".",
"split",
"(",
"s",
")",
"for",
"part",
"in",
"parts",
":",
"cf_func",
"=",
"replace_re",
".",
"search",
"(",
"part",
")",
"if",
"cf_func",
":",
"args",
"... | Parses UserData for Cloudformation helper functions.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-cloudformation.html#s... | [
"Parses",
"UserData",
"for",
"Cloudformation",
"helper",
"functions",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/tokenize_userdata.py#L22-L46 | train |
cloudtools/stacker | stacker/lookups/handlers/split.py | SplitLookup.handle | def handle(cls, value, **kwargs):
"""Split the supplied string on the given delimiter, providing a list.
Format of value:
<delimiter>::<value>
For example:
Subnets: ${split ,::subnet-1,subnet-2,subnet-3}
Would result in the variable `Subnets` getting a list c... | python | def handle(cls, value, **kwargs):
"""Split the supplied string on the given delimiter, providing a list.
Format of value:
<delimiter>::<value>
For example:
Subnets: ${split ,::subnet-1,subnet-2,subnet-3}
Would result in the variable `Subnets` getting a list c... | [
"def",
"handle",
"(",
"cls",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"delimiter",
",",
"text",
"=",
"value",
".",
"split",
"(",
"\"::\"",
",",
"1",
")",
"except",
"ValueError",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for ... | Split the supplied string on the given delimiter, providing a list.
Format of value:
<delimiter>::<value>
For example:
Subnets: ${split ,::subnet-1,subnet-2,subnet-3}
Would result in the variable `Subnets` getting a list consisting of:
["subnet-1", "subn... | [
"Split",
"the",
"supplied",
"string",
"on",
"the",
"given",
"delimiter",
"providing",
"a",
"list",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/lookups/handlers/split.py#L10-L40 | train |
cloudtools/stacker | stacker/actions/build.py | should_update | def should_update(stack):
"""Tests whether a stack should be submitted for updates to CF.
Args:
stack (:class:`stacker.stack.Stack`): The stack object to check.
Returns:
bool: If the stack should be updated, return True.
"""
if stack.locked:
if not stack.force:
... | python | def should_update(stack):
"""Tests whether a stack should be submitted for updates to CF.
Args:
stack (:class:`stacker.stack.Stack`): The stack object to check.
Returns:
bool: If the stack should be updated, return True.
"""
if stack.locked:
if not stack.force:
... | [
"def",
"should_update",
"(",
"stack",
")",
":",
"if",
"stack",
".",
"locked",
":",
"if",
"not",
"stack",
".",
"force",
":",
"logger",
".",
"debug",
"(",
"\"Stack %s locked and not in --force list. \"",
"\"Refusing to update.\"",
",",
"stack",
".",
"name",
")",
... | Tests whether a stack should be submitted for updates to CF.
Args:
stack (:class:`stacker.stack.Stack`): The stack object to check.
Returns:
bool: If the stack should be updated, return True. | [
"Tests",
"whether",
"a",
"stack",
"should",
"be",
"submitted",
"for",
"updates",
"to",
"CF",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/actions/build.py#L41-L59 | train |
cloudtools/stacker | stacker/actions/build.py | _resolve_parameters | def _resolve_parameters(parameters, blueprint):
"""Resolves CloudFormation Parameters for a given blueprint.
Given a list of parameters, handles:
- discard any parameters that the blueprint does not use
- discard any empty values
- convert booleans to strings suitable for CloudFormation... | python | def _resolve_parameters(parameters, blueprint):
"""Resolves CloudFormation Parameters for a given blueprint.
Given a list of parameters, handles:
- discard any parameters that the blueprint does not use
- discard any empty values
- convert booleans to strings suitable for CloudFormation... | [
"def",
"_resolve_parameters",
"(",
"parameters",
",",
"blueprint",
")",
":",
"params",
"=",
"{",
"}",
"param_defs",
"=",
"blueprint",
".",
"get_parameter_definitions",
"(",
")",
"for",
"key",
",",
"value",
"in",
"parameters",
".",
"items",
"(",
")",
":",
"... | Resolves CloudFormation Parameters for a given blueprint.
Given a list of parameters, handles:
- discard any parameters that the blueprint does not use
- discard any empty values
- convert booleans to strings suitable for CloudFormation
Args:
parameters (dict): A dictionary of ... | [
"Resolves",
"CloudFormation",
"Parameters",
"for",
"a",
"given",
"blueprint",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/actions/build.py#L93-L129 | train |
cloudtools/stacker | stacker/actions/build.py | _handle_missing_parameters | def _handle_missing_parameters(parameter_values, all_params, required_params,
existing_stack=None):
"""Handles any missing parameters.
If an existing_stack is provided, look up missing parameters there.
Args:
parameter_values (dict): key/value dictionary of stack def... | python | def _handle_missing_parameters(parameter_values, all_params, required_params,
existing_stack=None):
"""Handles any missing parameters.
If an existing_stack is provided, look up missing parameters there.
Args:
parameter_values (dict): key/value dictionary of stack def... | [
"def",
"_handle_missing_parameters",
"(",
"parameter_values",
",",
"all_params",
",",
"required_params",
",",
"existing_stack",
"=",
"None",
")",
":",
"missing_params",
"=",
"list",
"(",
"set",
"(",
"all_params",
")",
"-",
"set",
"(",
"parameter_values",
".",
"k... | Handles any missing parameters.
If an existing_stack is provided, look up missing parameters there.
Args:
parameter_values (dict): key/value dictionary of stack definition
parameters
all_params (list): A list of all the parameters used by the
template/blueprint.
... | [
"Handles",
"any",
"missing",
"parameters",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/actions/build.py#L139-L181 | train |
cloudtools/stacker | stacker/actions/build.py | Action.build_parameters | def build_parameters(self, stack, provider_stack=None):
"""Builds the CloudFormation Parameters for our stack.
Args:
stack (:class:`stacker.stack.Stack`): A stacker stack
provider_stack (dict): An optional Stacker provider object
Returns:
dict: The parameter... | python | def build_parameters(self, stack, provider_stack=None):
"""Builds the CloudFormation Parameters for our stack.
Args:
stack (:class:`stacker.stack.Stack`): A stacker stack
provider_stack (dict): An optional Stacker provider object
Returns:
dict: The parameter... | [
"def",
"build_parameters",
"(",
"self",
",",
"stack",
",",
"provider_stack",
"=",
"None",
")",
":",
"resolved",
"=",
"_resolve_parameters",
"(",
"stack",
".",
"parameter_values",
",",
"stack",
".",
"blueprint",
")",
"required_parameters",
"=",
"list",
"(",
"st... | Builds the CloudFormation Parameters for our stack.
Args:
stack (:class:`stacker.stack.Stack`): A stacker stack
provider_stack (dict): An optional Stacker provider object
Returns:
dict: The parameters for the given stack | [
"Builds",
"the",
"CloudFormation",
"Parameters",
"for",
"our",
"stack",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/actions/build.py#L222-L251 | train |
cloudtools/stacker | stacker/actions/build.py | Action._template | def _template(self, blueprint):
"""Generates a suitable template based on whether or not an S3 bucket
is set.
If an S3 bucket is set, then the template will be uploaded to S3 first,
and CreateStack/UpdateStack operations will use the uploaded template.
If not bucket is set, then... | python | def _template(self, blueprint):
"""Generates a suitable template based on whether or not an S3 bucket
is set.
If an S3 bucket is set, then the template will be uploaded to S3 first,
and CreateStack/UpdateStack operations will use the uploaded template.
If not bucket is set, then... | [
"def",
"_template",
"(",
"self",
",",
"blueprint",
")",
":",
"if",
"self",
".",
"bucket_name",
":",
"return",
"Template",
"(",
"url",
"=",
"self",
".",
"s3_stack_push",
"(",
"blueprint",
")",
")",
"else",
":",
"return",
"Template",
"(",
"body",
"=",
"b... | Generates a suitable template based on whether or not an S3 bucket
is set.
If an S3 bucket is set, then the template will be uploaded to S3 first,
and CreateStack/UpdateStack operations will use the uploaded template.
If not bucket is set, then the template will be inlined. | [
"Generates",
"a",
"suitable",
"template",
"based",
"on",
"whether",
"or",
"not",
"an",
"S3",
"bucket",
"is",
"set",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/actions/build.py#L375-L386 | train |
cloudtools/stacker | stacker/hooks/route53.py | create_domain | def create_domain(provider, context, **kwargs):
"""Create a domain within route53.
Args:
provider (:class:`stacker.providers.base.BaseProvider`): provider
instance
context (:class:`stacker.context.Context`): context instance
Returns: boolean for whether or not the hook succeede... | python | def create_domain(provider, context, **kwargs):
"""Create a domain within route53.
Args:
provider (:class:`stacker.providers.base.BaseProvider`): provider
instance
context (:class:`stacker.context.Context`): context instance
Returns: boolean for whether or not the hook succeede... | [
"def",
"create_domain",
"(",
"provider",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":",
"session",
"=",
"get_session",
"(",
"provider",
".",
"region",
")",
"client",
"=",
"session",
".",
"client",
"(",
"\"route53\"",
")",
"domain",
"=",
"kwargs",
"."... | Create a domain within route53.
Args:
provider (:class:`stacker.providers.base.BaseProvider`): provider
instance
context (:class:`stacker.context.Context`): context instance
Returns: boolean for whether or not the hook succeeded. | [
"Create",
"a",
"domain",
"within",
"route53",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/hooks/route53.py#L13-L31 | train |
cloudtools/stacker | stacker/ui.py | UI.info | def info(self, *args, **kwargs):
"""Logs the line of the current thread owns the underlying lock, or
blocks."""
self.lock()
try:
return logger.info(*args, **kwargs)
finally:
self.unlock() | python | def info(self, *args, **kwargs):
"""Logs the line of the current thread owns the underlying lock, or
blocks."""
self.lock()
try:
return logger.info(*args, **kwargs)
finally:
self.unlock() | [
"def",
"info",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"lock",
"(",
")",
"try",
":",
"return",
"logger",
".",
"info",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"finally",
":",
"self",
".",
"unlock",
... | Logs the line of the current thread owns the underlying lock, or
blocks. | [
"Logs",
"the",
"line",
"of",
"the",
"current",
"thread",
"owns",
"the",
"underlying",
"lock",
"or",
"blocks",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/ui.py#L37-L44 | train |
cloudtools/stacker | stacker/util.py | camel_to_snake | def camel_to_snake(name):
"""Converts CamelCase to snake_case.
Args:
name (string): The name to convert from CamelCase to snake_case.
Returns:
string: Converted string.
"""
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower() | python | def camel_to_snake(name):
"""Converts CamelCase to snake_case.
Args:
name (string): The name to convert from CamelCase to snake_case.
Returns:
string: Converted string.
"""
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower() | [
"def",
"camel_to_snake",
"(",
"name",
")",
":",
"s1",
"=",
"re",
".",
"sub",
"(",
"\"(.)([A-Z][a-z]+)\"",
",",
"r\"\\1_\\2\"",
",",
"name",
")",
"return",
"re",
".",
"sub",
"(",
"\"([a-z0-9])([A-Z])\"",
",",
"r\"\\1_\\2\"",
",",
"s1",
")",
".",
"lower",
... | Converts CamelCase to snake_case.
Args:
name (string): The name to convert from CamelCase to snake_case.
Returns:
string: Converted string. | [
"Converts",
"CamelCase",
"to",
"snake_case",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L34-L44 | train |
cloudtools/stacker | stacker/util.py | get_hosted_zone_by_name | def get_hosted_zone_by_name(client, zone_name):
"""Get the zone id of an existing zone by name.
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_name (string): The name of the DNS hosted zone to create.
Returns:
s... | python | def get_hosted_zone_by_name(client, zone_name):
"""Get the zone id of an existing zone by name.
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_name (string): The name of the DNS hosted zone to create.
Returns:
s... | [
"def",
"get_hosted_zone_by_name",
"(",
"client",
",",
"zone_name",
")",
":",
"p",
"=",
"client",
".",
"get_paginator",
"(",
"\"list_hosted_zones\"",
")",
"for",
"i",
"in",
"p",
".",
"paginate",
"(",
")",
":",
"for",
"zone",
"in",
"i",
"[",
"\"HostedZones\"... | Get the zone id of an existing zone by name.
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_name (string): The name of the DNS hosted zone to create.
Returns:
string: The Id of the Hosted Zone. | [
"Get",
"the",
"zone",
"id",
"of",
"an",
"existing",
"zone",
"by",
"name",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L64-L81 | train |
cloudtools/stacker | stacker/util.py | get_or_create_hosted_zone | def get_or_create_hosted_zone(client, zone_name):
"""Get the Id of an existing zone, or create it.
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_name (string): The name of the DNS hosted zone to create.
Returns:
... | python | def get_or_create_hosted_zone(client, zone_name):
"""Get the Id of an existing zone, or create it.
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_name (string): The name of the DNS hosted zone to create.
Returns:
... | [
"def",
"get_or_create_hosted_zone",
"(",
"client",
",",
"zone_name",
")",
":",
"zone_id",
"=",
"get_hosted_zone_by_name",
"(",
"client",
",",
"zone_name",
")",
"if",
"zone_id",
":",
"return",
"zone_id",
"logger",
".",
"debug",
"(",
"\"Zone %s does not exist, creatin... | Get the Id of an existing zone, or create it.
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_name (string): The name of the DNS hosted zone to create.
Returns:
string: The Id of the Hosted Zone. | [
"Get",
"the",
"Id",
"of",
"an",
"existing",
"zone",
"or",
"create",
"it",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L84-L106 | train |
cloudtools/stacker | stacker/util.py | get_soa_record | def get_soa_record(client, zone_id, zone_name):
"""Gets the SOA record for zone_name from zone_id.
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_id (string): The AWS Route53 zone id of the hosted zone to query.
zone... | python | def get_soa_record(client, zone_id, zone_name):
"""Gets the SOA record for zone_name from zone_id.
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_id (string): The AWS Route53 zone id of the hosted zone to query.
zone... | [
"def",
"get_soa_record",
"(",
"client",
",",
"zone_id",
",",
"zone_name",
")",
":",
"response",
"=",
"client",
".",
"list_resource_record_sets",
"(",
"HostedZoneId",
"=",
"zone_id",
",",
"StartRecordName",
"=",
"zone_name",
",",
"StartRecordType",
"=",
"\"SOA\"",
... | Gets the SOA record for zone_name from zone_id.
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_id (string): The AWS Route53 zone id of the hosted zone to query.
zone_name (string): The name of the DNS hosted zone to crea... | [
"Gets",
"the",
"SOA",
"record",
"for",
"zone_name",
"from",
"zone_id",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L130-L148 | train |
cloudtools/stacker | stacker/util.py | create_route53_zone | def create_route53_zone(client, zone_name):
"""Creates the given zone_name if it doesn't already exists.
Also sets the SOA negative caching TTL to something short (300 seconds).
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
... | python | def create_route53_zone(client, zone_name):
"""Creates the given zone_name if it doesn't already exists.
Also sets the SOA negative caching TTL to something short (300 seconds).
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
... | [
"def",
"create_route53_zone",
"(",
"client",
",",
"zone_name",
")",
":",
"if",
"not",
"zone_name",
".",
"endswith",
"(",
"\".\"",
")",
":",
"zone_name",
"+=",
"\".\"",
"zone_id",
"=",
"get_or_create_hosted_zone",
"(",
"client",
",",
"zone_name",
")",
"old_soa"... | Creates the given zone_name if it doesn't already exists.
Also sets the SOA negative caching TTL to something short (300 seconds).
Args:
client (:class:`botocore.client.Route53`): The connection used to
interact with Route53's API.
zone_name (string): The name of the DNS hosted zon... | [
"Creates",
"the",
"given",
"zone_name",
"if",
"it",
"doesn",
"t",
"already",
"exists",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L151-L199 | train |
cloudtools/stacker | stacker/util.py | load_object_from_string | def load_object_from_string(fqcn):
"""Converts "." delimited strings to a python object.
Given a "." delimited string representing the full path to an object
(function, class, variable) inside a module, return that object. Example:
load_object_from_string("os.path.basename")
load_object_from_stri... | python | def load_object_from_string(fqcn):
"""Converts "." delimited strings to a python object.
Given a "." delimited string representing the full path to an object
(function, class, variable) inside a module, return that object. Example:
load_object_from_string("os.path.basename")
load_object_from_stri... | [
"def",
"load_object_from_string",
"(",
"fqcn",
")",
":",
"module_path",
"=",
"\"__main__\"",
"object_name",
"=",
"fqcn",
"if",
"\".\"",
"in",
"fqcn",
":",
"module_path",
",",
"object_name",
"=",
"fqcn",
".",
"rsplit",
"(",
"\".\"",
",",
"1",
")",
"importlib"... | Converts "." delimited strings to a python object.
Given a "." delimited string representing the full path to an object
(function, class, variable) inside a module, return that object. Example:
load_object_from_string("os.path.basename")
load_object_from_string("logging.Logger")
load_object_from_... | [
"Converts",
".",
"delimited",
"strings",
"to",
"a",
"python",
"object",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L202-L217 | train |
cloudtools/stacker | stacker/util.py | merge_map | def merge_map(a, b):
"""Recursively merge elements of argument b into argument a.
Primarly used for merging two dictionaries together, where dict b takes
precedence over dict a. If 2 lists are provided, they are concatenated.
"""
if isinstance(a, list) and isinstance(b, list):
return a + b
... | python | def merge_map(a, b):
"""Recursively merge elements of argument b into argument a.
Primarly used for merging two dictionaries together, where dict b takes
precedence over dict a. If 2 lists are provided, they are concatenated.
"""
if isinstance(a, list) and isinstance(b, list):
return a + b
... | [
"def",
"merge_map",
"(",
"a",
",",
"b",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"list",
")",
"and",
"isinstance",
"(",
"b",
",",
"list",
")",
":",
"return",
"a",
"+",
"b",
"if",
"not",
"isinstance",
"(",
"a",
",",
"dict",
")",
"or",
"not",... | Recursively merge elements of argument b into argument a.
Primarly used for merging two dictionaries together, where dict b takes
precedence over dict a. If 2 lists are provided, they are concatenated. | [
"Recursively",
"merge",
"elements",
"of",
"argument",
"b",
"into",
"argument",
"a",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L220-L234 | train |
cloudtools/stacker | stacker/util.py | yaml_to_ordered_dict | def yaml_to_ordered_dict(stream, loader=yaml.SafeLoader):
"""Provides yaml.load alternative with preserved dictionary order.
Args:
stream (string): YAML string to load.
loader (:class:`yaml.loader`): PyYAML loader class. Defaults to safe
load.
Returns:
OrderedDict: Pars... | python | def yaml_to_ordered_dict(stream, loader=yaml.SafeLoader):
"""Provides yaml.load alternative with preserved dictionary order.
Args:
stream (string): YAML string to load.
loader (:class:`yaml.loader`): PyYAML loader class. Defaults to safe
load.
Returns:
OrderedDict: Pars... | [
"def",
"yaml_to_ordered_dict",
"(",
"stream",
",",
"loader",
"=",
"yaml",
".",
"SafeLoader",
")",
":",
"class",
"OrderedUniqueLoader",
"(",
"loader",
")",
":",
"\"\"\"\n Subclasses the given pyYAML `loader` class.\n\n Validates all sibling keys to insure no duplicat... | Provides yaml.load alternative with preserved dictionary order.
Args:
stream (string): YAML string to load.
loader (:class:`yaml.loader`): PyYAML loader class. Defaults to safe
load.
Returns:
OrderedDict: Parsed YAML. | [
"Provides",
"yaml",
".",
"load",
"alternative",
"with",
"preserved",
"dictionary",
"order",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L237-L320 | train |
cloudtools/stacker | stacker/util.py | cf_safe_name | def cf_safe_name(name):
"""Converts a name to a safe string for a Cloudformation resource.
Given a string, returns a name that is safe for use as a CloudFormation
Resource. (ie: Only alphanumeric characters)
"""
alphanumeric = r"[a-zA-Z0-9]+"
parts = re.findall(alphanumeric, name)
return ""... | python | def cf_safe_name(name):
"""Converts a name to a safe string for a Cloudformation resource.
Given a string, returns a name that is safe for use as a CloudFormation
Resource. (ie: Only alphanumeric characters)
"""
alphanumeric = r"[a-zA-Z0-9]+"
parts = re.findall(alphanumeric, name)
return ""... | [
"def",
"cf_safe_name",
"(",
"name",
")",
":",
"alphanumeric",
"=",
"r\"[a-zA-Z0-9]+\"",
"parts",
"=",
"re",
".",
"findall",
"(",
"alphanumeric",
",",
"name",
")",
"return",
"\"\"",
".",
"join",
"(",
"[",
"uppercase_first_letter",
"(",
"part",
")",
"for",
"... | Converts a name to a safe string for a Cloudformation resource.
Given a string, returns a name that is safe for use as a CloudFormation
Resource. (ie: Only alphanumeric characters) | [
"Converts",
"a",
"name",
"to",
"a",
"safe",
"string",
"for",
"a",
"Cloudformation",
"resource",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L328-L336 | train |
cloudtools/stacker | stacker/util.py | get_config_directory | def get_config_directory():
"""Return the directory the config file is located in.
This enables us to use relative paths in config values.
"""
# avoid circular import
from .commands.stacker import Stacker
command = Stacker()
namespace = command.parse_args()
return os.path.dirname(names... | python | def get_config_directory():
"""Return the directory the config file is located in.
This enables us to use relative paths in config values.
"""
# avoid circular import
from .commands.stacker import Stacker
command = Stacker()
namespace = command.parse_args()
return os.path.dirname(names... | [
"def",
"get_config_directory",
"(",
")",
":",
"# avoid circular import",
"from",
".",
"commands",
".",
"stacker",
"import",
"Stacker",
"command",
"=",
"Stacker",
"(",
")",
"namespace",
"=",
"command",
".",
"parse_args",
"(",
")",
"return",
"os",
".",
"path",
... | Return the directory the config file is located in.
This enables us to use relative paths in config values. | [
"Return",
"the",
"directory",
"the",
"config",
"file",
"is",
"located",
"in",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L339-L349 | train |
cloudtools/stacker | stacker/util.py | read_value_from_path | def read_value_from_path(value):
"""Enables translators to read values from files.
The value can be referred to with the `file://` prefix. ie:
conf_key: ${kms file://kms_value.txt}
"""
if value.startswith('file://'):
path = value.split('file://', 1)[1]
config_directory = get_c... | python | def read_value_from_path(value):
"""Enables translators to read values from files.
The value can be referred to with the `file://` prefix. ie:
conf_key: ${kms file://kms_value.txt}
"""
if value.startswith('file://'):
path = value.split('file://', 1)[1]
config_directory = get_c... | [
"def",
"read_value_from_path",
"(",
"value",
")",
":",
"if",
"value",
".",
"startswith",
"(",
"'file://'",
")",
":",
"path",
"=",
"value",
".",
"split",
"(",
"'file://'",
",",
"1",
")",
"[",
"1",
"]",
"config_directory",
"=",
"get_config_directory",
"(",
... | Enables translators to read values from files.
The value can be referred to with the `file://` prefix. ie:
conf_key: ${kms file://kms_value.txt} | [
"Enables",
"translators",
"to",
"read",
"values",
"from",
"files",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L352-L366 | train |
cloudtools/stacker | stacker/util.py | ensure_s3_bucket | def ensure_s3_bucket(s3_client, bucket_name, bucket_region):
"""Ensure an s3 bucket exists, if it does not then create it.
Args:
s3_client (:class:`botocore.client.Client`): An s3 client used to
verify and create the bucket.
bucket_name (str): The bucket being checked/created.
... | python | def ensure_s3_bucket(s3_client, bucket_name, bucket_region):
"""Ensure an s3 bucket exists, if it does not then create it.
Args:
s3_client (:class:`botocore.client.Client`): An s3 client used to
verify and create the bucket.
bucket_name (str): The bucket being checked/created.
... | [
"def",
"ensure_s3_bucket",
"(",
"s3_client",
",",
"bucket_name",
",",
"bucket_region",
")",
":",
"try",
":",
"s3_client",
".",
"head_bucket",
"(",
"Bucket",
"=",
"bucket_name",
")",
"except",
"botocore",
".",
"exceptions",
".",
"ClientError",
"as",
"e",
":",
... | Ensure an s3 bucket exists, if it does not then create it.
Args:
s3_client (:class:`botocore.client.Client`): An s3 client used to
verify and create the bucket.
bucket_name (str): The bucket being checked/created.
bucket_region (str, optional): The region to create the bucket in... | [
"Ensure",
"an",
"s3",
"bucket",
"exists",
"if",
"it",
"does",
"not",
"then",
"create",
"it",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L415-L447 | train |
cloudtools/stacker | stacker/util.py | SourceProcessor.create_cache_directories | def create_cache_directories(self):
"""Ensure that SourceProcessor cache directories exist."""
if not os.path.isdir(self.package_cache_dir):
if not os.path.isdir(self.stacker_cache_dir):
os.mkdir(self.stacker_cache_dir)
os.mkdir(self.package_cache_dir) | python | def create_cache_directories(self):
"""Ensure that SourceProcessor cache directories exist."""
if not os.path.isdir(self.package_cache_dir):
if not os.path.isdir(self.stacker_cache_dir):
os.mkdir(self.stacker_cache_dir)
os.mkdir(self.package_cache_dir) | [
"def",
"create_cache_directories",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"package_cache_dir",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"stacker_cache_dir",
")",
":",
"os"... | Ensure that SourceProcessor cache directories exist. | [
"Ensure",
"that",
"SourceProcessor",
"cache",
"directories",
"exist",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L553-L558 | train |
cloudtools/stacker | stacker/util.py | SourceProcessor.get_package_sources | def get_package_sources(self):
"""Make remote python packages available for local use."""
# Checkout local modules
for config in self.sources.get('local', []):
self.fetch_local_package(config=config)
# Checkout S3 repositories specified in config
for config in self.so... | python | def get_package_sources(self):
"""Make remote python packages available for local use."""
# Checkout local modules
for config in self.sources.get('local', []):
self.fetch_local_package(config=config)
# Checkout S3 repositories specified in config
for config in self.so... | [
"def",
"get_package_sources",
"(",
"self",
")",
":",
"# Checkout local modules",
"for",
"config",
"in",
"self",
".",
"sources",
".",
"get",
"(",
"'local'",
",",
"[",
"]",
")",
":",
"self",
".",
"fetch_local_package",
"(",
"config",
"=",
"config",
")",
"# C... | Make remote python packages available for local use. | [
"Make",
"remote",
"python",
"packages",
"available",
"for",
"local",
"use",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L560-L570 | train |
cloudtools/stacker | stacker/util.py | SourceProcessor.fetch_local_package | def fetch_local_package(self, config):
"""Make a local path available to current stacker config.
Args:
config (dict): 'local' path config dictionary
"""
# Update sys.path & merge in remote configs (if necessary)
self.update_paths_and_config(config=config,
... | python | def fetch_local_package(self, config):
"""Make a local path available to current stacker config.
Args:
config (dict): 'local' path config dictionary
"""
# Update sys.path & merge in remote configs (if necessary)
self.update_paths_and_config(config=config,
... | [
"def",
"fetch_local_package",
"(",
"self",
",",
"config",
")",
":",
"# Update sys.path & merge in remote configs (if necessary)",
"self",
".",
"update_paths_and_config",
"(",
"config",
"=",
"config",
",",
"pkg_dir_name",
"=",
"config",
"[",
"'source'",
"]",
",",
"pkg_... | Make a local path available to current stacker config.
Args:
config (dict): 'local' path config dictionary | [
"Make",
"a",
"local",
"path",
"available",
"to",
"current",
"stacker",
"config",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L572-L582 | train |
cloudtools/stacker | stacker/util.py | SourceProcessor.fetch_git_package | def fetch_git_package(self, config):
"""Make a remote git repository available for local use.
Args:
config (dict): git config dictionary
"""
# only loading git here when needed to avoid load errors on systems
# without git installed
from git import Repo
... | python | def fetch_git_package(self, config):
"""Make a remote git repository available for local use.
Args:
config (dict): git config dictionary
"""
# only loading git here when needed to avoid load errors on systems
# without git installed
from git import Repo
... | [
"def",
"fetch_git_package",
"(",
"self",
",",
"config",
")",
":",
"# only loading git here when needed to avoid load errors on systems",
"# without git installed",
"from",
"git",
"import",
"Repo",
"ref",
"=",
"self",
".",
"determine_git_ref",
"(",
"config",
")",
"dir_name... | Make a remote git repository available for local use.
Args:
config (dict): git config dictionary | [
"Make",
"a",
"remote",
"git",
"repository",
"available",
"for",
"local",
"use",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L682-L720 | train |
cloudtools/stacker | stacker/util.py | SourceProcessor.update_paths_and_config | def update_paths_and_config(self, config, pkg_dir_name,
pkg_cache_dir=None):
"""Handle remote source defined sys.paths & configs.
Args:
config (dict): git config dictionary
pkg_dir_name (string): directory name of the stacker archive
p... | python | def update_paths_and_config(self, config, pkg_dir_name,
pkg_cache_dir=None):
"""Handle remote source defined sys.paths & configs.
Args:
config (dict): git config dictionary
pkg_dir_name (string): directory name of the stacker archive
p... | [
"def",
"update_paths_and_config",
"(",
"self",
",",
"config",
",",
"pkg_dir_name",
",",
"pkg_cache_dir",
"=",
"None",
")",
":",
"if",
"pkg_cache_dir",
"is",
"None",
":",
"pkg_cache_dir",
"=",
"self",
".",
"package_cache_dir",
"cached_dir_path",
"=",
"os",
".",
... | Handle remote source defined sys.paths & configs.
Args:
config (dict): git config dictionary
pkg_dir_name (string): directory name of the stacker archive
pkg_cache_dir (string): fully qualified path to stacker cache
cache directory | [
"Handle",
"remote",
"source",
"defined",
"sys",
".",
"paths",
"&",
"configs",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L722-L753 | train |
cloudtools/stacker | stacker/util.py | SourceProcessor.git_ls_remote | def git_ls_remote(self, uri, ref):
"""Determine the latest commit id for a given ref.
Args:
uri (string): git URI
ref (string): git ref
Returns:
str: A commit id
"""
logger.debug("Invoking git to retrieve commit id for repo %s...", uri)
... | python | def git_ls_remote(self, uri, ref):
"""Determine the latest commit id for a given ref.
Args:
uri (string): git URI
ref (string): git ref
Returns:
str: A commit id
"""
logger.debug("Invoking git to retrieve commit id for repo %s...", uri)
... | [
"def",
"git_ls_remote",
"(",
"self",
",",
"uri",
",",
"ref",
")",
":",
"logger",
".",
"debug",
"(",
"\"Invoking git to retrieve commit id for repo %s...\"",
",",
"uri",
")",
"lsremote_output",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'git'",
",",
"'ls-... | Determine the latest commit id for a given ref.
Args:
uri (string): git URI
ref (string): git ref
Returns:
str: A commit id | [
"Determine",
"the",
"latest",
"commit",
"id",
"for",
"a",
"given",
"ref",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L755-L776 | train |
cloudtools/stacker | stacker/util.py | SourceProcessor.determine_git_ref | def determine_git_ref(self, config):
"""Determine the ref to be used for 'git checkout'.
Args:
config (dict): git config dictionary
Returns:
str: A commit id or tag name
"""
# First ensure redundant config keys aren't specified (which could
# ca... | python | def determine_git_ref(self, config):
"""Determine the ref to be used for 'git checkout'.
Args:
config (dict): git config dictionary
Returns:
str: A commit id or tag name
"""
# First ensure redundant config keys aren't specified (which could
# ca... | [
"def",
"determine_git_ref",
"(",
"self",
",",
"config",
")",
":",
"# First ensure redundant config keys aren't specified (which could",
"# cause confusion as to which take precedence)",
"ref_config_keys",
"=",
"0",
"for",
"i",
"in",
"[",
"'commit'",
",",
"'tag'",
",",
"'bra... | Determine the ref to be used for 'git checkout'.
Args:
config (dict): git config dictionary
Returns:
str: A commit id or tag name | [
"Determine",
"the",
"ref",
"to",
"be",
"used",
"for",
"git",
"checkout",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L796-L832 | train |
cloudtools/stacker | stacker/util.py | SourceProcessor.sanitize_git_path | def sanitize_git_path(self, uri, ref=None):
"""Take a git URI and ref and converts it to a directory safe path.
Args:
uri (string): git URI
(e.g. git@github.com:foo/bar.git)
ref (string): optional git ref to be appended to the path
Returns:
... | python | def sanitize_git_path(self, uri, ref=None):
"""Take a git URI and ref and converts it to a directory safe path.
Args:
uri (string): git URI
(e.g. git@github.com:foo/bar.git)
ref (string): optional git ref to be appended to the path
Returns:
... | [
"def",
"sanitize_git_path",
"(",
"self",
",",
"uri",
",",
"ref",
"=",
"None",
")",
":",
"if",
"uri",
".",
"endswith",
"(",
"'.git'",
")",
":",
"dir_name",
"=",
"uri",
"[",
":",
"-",
"4",
"]",
"# drop .git",
"else",
":",
"dir_name",
"=",
"uri",
"dir... | Take a git URI and ref and converts it to a directory safe path.
Args:
uri (string): git URI
(e.g. git@github.com:foo/bar.git)
ref (string): optional git ref to be appended to the path
Returns:
str: Directory name for the supplied uri | [
"Take",
"a",
"git",
"URI",
"and",
"ref",
"and",
"converts",
"it",
"to",
"a",
"directory",
"safe",
"path",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/util.py#L848-L867 | train |
cloudtools/stacker | stacker/hooks/command.py | run_command | def run_command(provider, context, command, capture=False, interactive=False,
ignore_status=False, quiet=False, stdin=None, env=None,
**kwargs):
"""Run a custom command as a hook
Keyword Arguments:
command (list or str):
Command to run
capture (bool, ... | python | def run_command(provider, context, command, capture=False, interactive=False,
ignore_status=False, quiet=False, stdin=None, env=None,
**kwargs):
"""Run a custom command as a hook
Keyword Arguments:
command (list or str):
Command to run
capture (bool, ... | [
"def",
"run_command",
"(",
"provider",
",",
"context",
",",
"command",
",",
"capture",
"=",
"False",
",",
"interactive",
"=",
"False",
",",
"ignore_status",
"=",
"False",
",",
"quiet",
"=",
"False",
",",
"stdin",
"=",
"None",
",",
"env",
"=",
"None",
"... | Run a custom command as a hook
Keyword Arguments:
command (list or str):
Command to run
capture (bool, optional):
If enabled, capture the command's stdout and stderr, and return
them in the hook result. Default: false
interactive (bool, optional):
... | [
"Run",
"a",
"custom",
"command",
"as",
"a",
"hook"
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/hooks/command.py#L18-L124 | train |
cloudtools/stacker | stacker/hooks/keypair.py | ensure_keypair_exists | def ensure_keypair_exists(provider, context, **kwargs):
"""Ensure a specific keypair exists within AWS.
If the key doesn't exist, upload it.
Args:
provider (:class:`stacker.providers.base.BaseProvider`): provider
instance
context (:class:`stacker.context.Context`): context inst... | python | def ensure_keypair_exists(provider, context, **kwargs):
"""Ensure a specific keypair exists within AWS.
If the key doesn't exist, upload it.
Args:
provider (:class:`stacker.providers.base.BaseProvider`): provider
instance
context (:class:`stacker.context.Context`): context inst... | [
"def",
"ensure_keypair_exists",
"(",
"provider",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":",
"keypair_name",
"=",
"kwargs",
"[",
"\"keypair\"",
"]",
"ssm_parameter_name",
"=",
"kwargs",
".",
"get",
"(",
"\"ssm_parameter_name\"",
")",
"ssm_key_id",
"=",
... | Ensure a specific keypair exists within AWS.
If the key doesn't exist, upload it.
Args:
provider (:class:`stacker.providers.base.BaseProvider`): provider
instance
context (:class:`stacker.context.Context`): context instance
keypair (str): name of the key pair to create
... | [
"Ensure",
"a",
"specific",
"keypair",
"exists",
"within",
"AWS",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/hooks/keypair.py#L184-L252 | train |
cloudtools/stacker | stacker/context.py | get_fqn | def get_fqn(base_fqn, delimiter, name=None):
"""Return the fully qualified name of an object within this context.
If the name passed already appears to be a fully qualified name, it
will be returned with no further processing.
"""
if name and name.startswith("%s%s" % (base_fqn, delimiter)):
... | python | def get_fqn(base_fqn, delimiter, name=None):
"""Return the fully qualified name of an object within this context.
If the name passed already appears to be a fully qualified name, it
will be returned with no further processing.
"""
if name and name.startswith("%s%s" % (base_fqn, delimiter)):
... | [
"def",
"get_fqn",
"(",
"base_fqn",
",",
"delimiter",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"and",
"name",
".",
"startswith",
"(",
"\"%s%s\"",
"%",
"(",
"base_fqn",
",",
"delimiter",
")",
")",
":",
"return",
"name",
"return",
"delimiter",
".... | Return the fully qualified name of an object within this context.
If the name passed already appears to be a fully qualified name, it
will be returned with no further processing. | [
"Return",
"the",
"fully",
"qualified",
"name",
"of",
"an",
"object",
"within",
"this",
"context",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/context.py#L19-L29 | train |
cloudtools/stacker | stacker/context.py | Context.get_targets | def get_targets(self):
"""Returns the named targets that are specified in the config.
Returns:
list: a list of :class:`stacker.target.Target` objects
"""
if not hasattr(self, "_targets"):
targets = []
for target_def in self.config.targets or []:
... | python | def get_targets(self):
"""Returns the named targets that are specified in the config.
Returns:
list: a list of :class:`stacker.target.Target` objects
"""
if not hasattr(self, "_targets"):
targets = []
for target_def in self.config.targets or []:
... | [
"def",
"get_targets",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_targets\"",
")",
":",
"targets",
"=",
"[",
"]",
"for",
"target_def",
"in",
"self",
".",
"config",
".",
"targets",
"or",
"[",
"]",
":",
"target",
"=",
"Target",... | Returns the named targets that are specified in the config.
Returns:
list: a list of :class:`stacker.target.Target` objects | [
"Returns",
"the",
"named",
"targets",
"that",
"are",
"specified",
"in",
"the",
"config",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/context.py#L127-L140 | train |
cloudtools/stacker | stacker/context.py | Context.get_stacks | def get_stacks(self):
"""Get the stacks for the current action.
Handles configuring the :class:`stacker.stack.Stack` objects that will
be used in the current action.
Returns:
list: a list of :class:`stacker.stack.Stack` objects
"""
if not hasattr(self, "_st... | python | def get_stacks(self):
"""Get the stacks for the current action.
Handles configuring the :class:`stacker.stack.Stack` objects that will
be used in the current action.
Returns:
list: a list of :class:`stacker.stack.Stack` objects
"""
if not hasattr(self, "_st... | [
"def",
"get_stacks",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_stacks\"",
")",
":",
"stacks",
"=",
"[",
"]",
"definitions",
"=",
"self",
".",
"_get_stack_definitions",
"(",
")",
"for",
"stack_def",
"in",
"definitions",
":",
"st... | Get the stacks for the current action.
Handles configuring the :class:`stacker.stack.Stack` objects that will
be used in the current action.
Returns:
list: a list of :class:`stacker.stack.Stack` objects | [
"Get",
"the",
"stacks",
"for",
"the",
"current",
"action",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/context.py#L142-L167 | train |
cloudtools/stacker | stacker/context.py | Context.set_hook_data | def set_hook_data(self, key, data):
"""Set hook data for the given key.
Args:
key(str): The key to store the hook data in.
data(:class:`collections.Mapping`): A dictionary of data to store,
as returned from a hook.
"""
if not isinstance(data, col... | python | def set_hook_data(self, key, data):
"""Set hook data for the given key.
Args:
key(str): The key to store the hook data in.
data(:class:`collections.Mapping`): A dictionary of data to store,
as returned from a hook.
"""
if not isinstance(data, col... | [
"def",
"set_hook_data",
"(",
"self",
",",
"key",
",",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"collections",
".",
"Mapping",
")",
":",
"raise",
"ValueError",
"(",
"\"Hook (key: %s) data must be an instance of \"",
"\"collections.Mapping (a dic... | Set hook data for the given key.
Args:
key(str): The key to store the hook data in.
data(:class:`collections.Mapping`): A dictionary of data to store,
as returned from a hook. | [
"Set",
"hook",
"data",
"for",
"the",
"given",
"key",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/context.py#L186-L204 | train |
cloudtools/stacker | stacker/config/__init__.py | render_parse_load | def render_parse_load(raw_config, environment=None, validate=True):
"""Encapsulates the render -> parse -> validate -> load process.
Args:
raw_config (str): the raw stacker configuration string.
environment (dict, optional): any environment values that should be
passed to the config... | python | def render_parse_load(raw_config, environment=None, validate=True):
"""Encapsulates the render -> parse -> validate -> load process.
Args:
raw_config (str): the raw stacker configuration string.
environment (dict, optional): any environment values that should be
passed to the config... | [
"def",
"render_parse_load",
"(",
"raw_config",
",",
"environment",
"=",
"None",
",",
"validate",
"=",
"True",
")",
":",
"pre_rendered",
"=",
"render",
"(",
"raw_config",
",",
"environment",
")",
"rendered",
"=",
"process_remote_sources",
"(",
"pre_rendered",
","... | Encapsulates the render -> parse -> validate -> load process.
Args:
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... | [
"Encapsulates",
"the",
"render",
"-",
">",
"parse",
"-",
">",
"validate",
"-",
">",
"load",
"process",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/config/__init__.py#L42-L78 | train |
cloudtools/stacker | stacker/config/__init__.py | render | def render(raw_config, environment=None):
"""Renders a config, using it as a template with the environment.
Args:
raw_config (str): the raw stacker configuration string.
environment (dict, optional): any environment values that should be
passed to the config
Returns:
st... | python | def render(raw_config, environment=None):
"""Renders a config, using it as a template with the environment.
Args:
raw_config (str): the raw stacker configuration string.
environment (dict, optional): any environment values that should be
passed to the config
Returns:
st... | [
"def",
"render",
"(",
"raw_config",
",",
"environment",
"=",
"None",
")",
":",
"t",
"=",
"Template",
"(",
"raw_config",
")",
"buff",
"=",
"StringIO",
"(",
")",
"if",
"not",
"environment",
":",
"environment",
"=",
"{",
"}",
"try",
":",
"substituted",
"=... | Renders a config, using it as a template with the environment.
Args:
raw_config (str): the raw stacker configuration string.
environment (dict, optional): any environment values that should be
passed to the config
Returns:
str: the stacker configuration populated with any v... | [
"Renders",
"a",
"config",
"using",
"it",
"as",
"a",
"template",
"with",
"the",
"environment",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/config/__init__.py#L81-L112 | train |
cloudtools/stacker | stacker/config/__init__.py | parse | def parse(raw_config):
"""Parse a raw yaml formatted stacker config.
Args:
raw_config (str): the raw stacker configuration string in yaml format.
Returns:
:class:`Config`: the parsed stacker config.
"""
# Convert any applicable dictionaries back into lists
# This is necessary... | python | def parse(raw_config):
"""Parse a raw yaml formatted stacker config.
Args:
raw_config (str): the raw stacker configuration string in yaml format.
Returns:
:class:`Config`: the parsed stacker config.
"""
# Convert any applicable dictionaries back into lists
# This is necessary... | [
"def",
"parse",
"(",
"raw_config",
")",
":",
"# Convert any applicable dictionaries back into lists",
"# This is necessary due to the move from lists for these top level config",
"# values to either lists or OrderedDicts.",
"# Eventually we should probably just make them OrderedDicts only.",
"co... | Parse a raw yaml formatted stacker config.
Args:
raw_config (str): the raw stacker configuration string in yaml format.
Returns:
:class:`Config`: the parsed stacker config. | [
"Parse",
"a",
"raw",
"yaml",
"formatted",
"stacker",
"config",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/config/__init__.py#L115-L149 | train |
cloudtools/stacker | stacker/config/__init__.py | load | def load(config):
"""Loads a stacker configuration by modifying sys paths, loading lookups,
etc.
Args:
config (:class:`Config`): the stacker config to load.
Returns:
:class:`Config`: the stacker config provided above.
"""
if config.sys_path:
logger.debug("Appending %s... | python | def load(config):
"""Loads a stacker configuration by modifying sys paths, loading lookups,
etc.
Args:
config (:class:`Config`): the stacker config to load.
Returns:
:class:`Config`: the stacker config provided above.
"""
if config.sys_path:
logger.debug("Appending %s... | [
"def",
"load",
"(",
"config",
")",
":",
"if",
"config",
".",
"sys_path",
":",
"logger",
".",
"debug",
"(",
"\"Appending %s to sys.path.\"",
",",
"config",
".",
"sys_path",
")",
"sys",
".",
"path",
".",
"append",
"(",
"config",
".",
"sys_path",
")",
"logg... | Loads a stacker configuration by modifying sys paths, loading lookups,
etc.
Args:
config (:class:`Config`): the stacker config to load.
Returns:
:class:`Config`: the stacker config provided above. | [
"Loads",
"a",
"stacker",
"configuration",
"by",
"modifying",
"sys",
"paths",
"loading",
"lookups",
"etc",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/config/__init__.py#L152-L172 | train |
cloudtools/stacker | stacker/config/__init__.py | dump | def dump(config):
"""Dumps a stacker Config object as yaml.
Args:
config (:class:`Config`): the stacker Config object.
stream (stream): an optional stream object to write to.
Returns:
str: the yaml formatted stacker Config.
"""
return yaml.safe_dump(
config.to_pri... | python | def dump(config):
"""Dumps a stacker Config object as yaml.
Args:
config (:class:`Config`): the stacker Config object.
stream (stream): an optional stream object to write to.
Returns:
str: the yaml formatted stacker Config.
"""
return yaml.safe_dump(
config.to_pri... | [
"def",
"dump",
"(",
"config",
")",
":",
"return",
"yaml",
".",
"safe_dump",
"(",
"config",
".",
"to_primitive",
"(",
")",
",",
"default_flow_style",
"=",
"False",
",",
"encoding",
"=",
"'utf-8'",
",",
"allow_unicode",
"=",
"True",
")"
] | Dumps a stacker Config object as yaml.
Args:
config (:class:`Config`): the stacker Config object.
stream (stream): an optional stream object to write to.
Returns:
str: the yaml formatted stacker Config. | [
"Dumps",
"a",
"stacker",
"Config",
"object",
"as",
"yaml",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/config/__init__.py#L175-L191 | train |
cloudtools/stacker | stacker/config/__init__.py | process_remote_sources | def process_remote_sources(raw_config, environment=None):
"""Stage remote package sources and merge in remote configs.
Args:
raw_config (str): the raw stacker configuration string.
environment (dict, optional): any environment values that should be
passed to the config
Returns:... | python | def process_remote_sources(raw_config, environment=None):
"""Stage remote package sources and merge in remote configs.
Args:
raw_config (str): the raw stacker configuration string.
environment (dict, optional): any environment values that should be
passed to the config
Returns:... | [
"def",
"process_remote_sources",
"(",
"raw_config",
",",
"environment",
"=",
"None",
")",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"raw_config",
")",
"if",
"config",
"and",
"config",
".",
"get",
"(",
"'package_sources'",
")",
":",
"processor",
"=",... | Stage remote package sources and merge in remote configs.
Args:
raw_config (str): the raw stacker configuration string.
environment (dict, optional): any environment values that should be
passed to the config
Returns:
str: the raw stacker configuration string | [
"Stage",
"remote",
"package",
"sources",
"and",
"merge",
"in",
"remote",
"configs",
"."
] | ad6013a03a560c46ba3c63c4d153336273e6da5d | https://github.com/cloudtools/stacker/blob/ad6013a03a560c46ba3c63c4d153336273e6da5d/stacker/config/__init__.py#L194-L225 | train |
SoCo/SoCo | soco/plugins/wimp.py | _post | def _post(url, headers, body, retries=3, timeout=3.0):
"""Try 3 times to request the content.
:param headers: The HTTP headers
:type headers: dict
:param body: The body of the HTTP post
:type body: str
:param retries: The number of times to retry before giving up
:type retries: int
:par... | python | def _post(url, headers, body, retries=3, timeout=3.0):
"""Try 3 times to request the content.
:param headers: The HTTP headers
:type headers: dict
:param body: The body of the HTTP post
:type body: str
:param retries: The number of times to retry before giving up
:type retries: int
:par... | [
"def",
"_post",
"(",
"url",
",",
"headers",
",",
"body",
",",
"retries",
"=",
"3",
",",
"timeout",
"=",
"3.0",
")",
":",
"retry",
"=",
"0",
"out",
"=",
"None",
"while",
"out",
"is",
"None",
":",
"try",
":",
"out",
"=",
"requests",
".",
"post",
... | Try 3 times to request the content.
:param headers: The HTTP headers
:type headers: dict
:param body: The body of the HTTP post
:type body: str
:param retries: The number of times to retry before giving up
:type retries: int
:param timeout: The time to wait for the post to complete, before ... | [
"Try",
"3",
"times",
"to",
"request",
"the",
"content",
"."
] | 671937e07d7973b78c0cbee153d4f3ad68ec48c6 | https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/plugins/wimp.py#L28-L56 | train |
SoCo/SoCo | soco/plugins/wimp.py | _get_header | def _get_header(soap_action):
"""Return the HTTP for SOAP Action.
:param soap_action: The soap action to include in the header. Can be either
'search' or 'get_metadata'
:type soap_action: str
"""
# This way of setting accepted language is obviously flawed, in that it
# depends on the lo... | python | def _get_header(soap_action):
"""Return the HTTP for SOAP Action.
:param soap_action: The soap action to include in the header. Can be either
'search' or 'get_metadata'
:type soap_action: str
"""
# This way of setting accepted language is obviously flawed, in that it
# depends on the lo... | [
"def",
"_get_header",
"(",
"soap_action",
")",
":",
"# This way of setting accepted language is obviously flawed, in that it",
"# depends on the locale settings of the system. However, I'm unsure if",
"# they are actually used. The character coding is set elsewhere and I think",
"# the available m... | Return the HTTP for SOAP Action.
:param soap_action: The soap action to include in the header. Can be either
'search' or 'get_metadata'
:type soap_action: str | [
"Return",
"the",
"HTTP",
"for",
"SOAP",
"Action",
"."
] | 671937e07d7973b78c0cbee153d4f3ad68ec48c6 | https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/plugins/wimp.py#L72-L96 | train |
SoCo/SoCo | soco/plugins/wimp.py | Wimp.get_tracks | def get_tracks(self, search, start=0, max_items=100):
"""Search for tracks.
See get_music_service_information for details on the arguments
"""
return self.get_music_service_information('tracks', search, start,
max_items) | python | def get_tracks(self, search, start=0, max_items=100):
"""Search for tracks.
See get_music_service_information for details on the arguments
"""
return self.get_music_service_information('tracks', search, start,
max_items) | [
"def",
"get_tracks",
"(",
"self",
",",
"search",
",",
"start",
"=",
"0",
",",
"max_items",
"=",
"100",
")",
":",
"return",
"self",
".",
"get_music_service_information",
"(",
"'tracks'",
",",
"search",
",",
"start",
",",
"max_items",
")"
] | Search for tracks.
See get_music_service_information for details on the arguments | [
"Search",
"for",
"tracks",
"."
] | 671937e07d7973b78c0cbee153d4f3ad68ec48c6 | https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/plugins/wimp.py#L192-L198 | train |
SoCo/SoCo | soco/plugins/wimp.py | Wimp.get_albums | def get_albums(self, search, start=0, max_items=100):
"""Search for albums.
See get_music_service_information for details on the arguments
"""
return self.get_music_service_information('albums', search, start,
max_items) | python | def get_albums(self, search, start=0, max_items=100):
"""Search for albums.
See get_music_service_information for details on the arguments
"""
return self.get_music_service_information('albums', search, start,
max_items) | [
"def",
"get_albums",
"(",
"self",
",",
"search",
",",
"start",
"=",
"0",
",",
"max_items",
"=",
"100",
")",
":",
"return",
"self",
".",
"get_music_service_information",
"(",
"'albums'",
",",
"search",
",",
"start",
",",
"max_items",
")"
] | Search for albums.
See get_music_service_information for details on the arguments | [
"Search",
"for",
"albums",
"."
] | 671937e07d7973b78c0cbee153d4f3ad68ec48c6 | https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/plugins/wimp.py#L200-L206 | train |
SoCo/SoCo | soco/plugins/wimp.py | Wimp.get_artists | def get_artists(self, search, start=0, max_items=100):
"""Search for artists.
See get_music_service_information for details on the arguments
"""
return self.get_music_service_information('artists', search, start,
max_items) | python | def get_artists(self, search, start=0, max_items=100):
"""Search for artists.
See get_music_service_information for details on the arguments
"""
return self.get_music_service_information('artists', search, start,
max_items) | [
"def",
"get_artists",
"(",
"self",
",",
"search",
",",
"start",
"=",
"0",
",",
"max_items",
"=",
"100",
")",
":",
"return",
"self",
".",
"get_music_service_information",
"(",
"'artists'",
",",
"search",
",",
"start",
",",
"max_items",
")"
] | Search for artists.
See get_music_service_information for details on the arguments | [
"Search",
"for",
"artists",
"."
] | 671937e07d7973b78c0cbee153d4f3ad68ec48c6 | https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/plugins/wimp.py#L208-L214 | train |
SoCo/SoCo | soco/plugins/wimp.py | Wimp.get_playlists | def get_playlists(self, search, start=0, max_items=100):
"""Search for playlists.
See get_music_service_information for details on the arguments.
Note:
Un-intuitively this method returns MSAlbumList items. See
note in class doc string for details.
"""
r... | python | def get_playlists(self, search, start=0, max_items=100):
"""Search for playlists.
See get_music_service_information for details on the arguments.
Note:
Un-intuitively this method returns MSAlbumList items. See
note in class doc string for details.
"""
r... | [
"def",
"get_playlists",
"(",
"self",
",",
"search",
",",
"start",
"=",
"0",
",",
"max_items",
"=",
"100",
")",
":",
"return",
"self",
".",
"get_music_service_information",
"(",
"'playlists'",
",",
"search",
",",
"start",
",",
"max_items",
")"
] | Search for playlists.
See get_music_service_information for details on the arguments.
Note:
Un-intuitively this method returns MSAlbumList items. See
note in class doc string for details. | [
"Search",
"for",
"playlists",
"."
] | 671937e07d7973b78c0cbee153d4f3ad68ec48c6 | https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/plugins/wimp.py#L216-L227 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.