Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_env(ctx, environment):
"""
Initialises and returns a sceptre.environment.Environment().
:param sceptre_dir: The absolute path to the Sceptre directory.
:type project dir: str
:param environment: The name of the environment.
:type environment: str
:returns: An Environment.
:rtype: sceptre.environment.Environment
"""
config_reader = ConfigReader(
ctx.obj["sceptre_dir"], ctx.obj["templating_vars"]
)
return config_reader.construct_environment(environment)
def _get_stack(ctx, environment, stack):
"""
Initialises and returns a sceptre.stack.Stack().
:param sceptre_dir: The absolute path to the Sceptre directory.
:type project dir: str
:param environment: The name of the environment.
:type environment: str
:param stack: The name of the stack.
:type stack: str
:returns: A Stack.
:rtype: sceptre.stack.Stack
"""
path = os.path.join(environment, stack) + ".yaml"
config_reader = ConfigReader(
ctx.obj["sceptre_dir"], ctx.obj["templating_vars"]
)
return config_reader.construct_stack(path)