How to use the sceptre.plan.plan.SceptrePlan function in sceptre

To help you get started, we’ve selected a few sceptre examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Sceptre / sceptre / integration-tests / steps / stack_groups.py View on Github external
def step_impl(context, stack_group_name):
    sceptre_context = SceptreContext(
        command_path=stack_group_name,
        project_path=context.sceptre_dir,
        ignore_dependencies=True
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    sceptre_plan.delete()
github Sceptre / sceptre / integration-tests / steps / change_sets.py View on Github external
def step_impl(context, change_set_name, stack_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + '.yaml',
        project_path=context.sceptre_dir,
        ignore_dependencies=True
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    allowed_errors = {'ValidationError', 'ChangeSetNotFound'}

    try:
        sceptre_plan.execute_change_set(change_set_name)
    except ClientError as e:
        if e.response['Error']['Code'] in allowed_errors:
            context.error = e
            return
        else:
            raise e
github Sceptre / sceptre / integration-tests / steps / stacks.py View on Github external
def step_impl(context, stack_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + '.yaml',
        project_path=context.sceptre_dir,
        ignore_dependencies=True
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    try:
        sceptre_plan.update()
    except ClientError as e:
        message = e.response['Error']['Message']
        if e.response['Error']['Code'] == 'ValidationError' \
                and message.endswith("does not exist"):
            return
        else:
            raise e
github Sceptre / sceptre / integration-tests / steps / change_sets.py View on Github external
def step_impl(context, change_set_name, stack_name):
    sceptre_context = SceptreContext(
        command_path=stack_name + '.yaml',
        project_path=context.sceptre_dir
    )

    sceptre_plan = SceptrePlan(sceptre_context)
    allowed_errors = {'ValidationError', 'ChangeSetNotFound'}

    try:
        responses = sceptre_plan.describe_change_set(change_set_name)
    except ClientError as e:
        if e.response['Error']['Code'] in allowed_errors:
            context.error = e
            return
        else:
            raise e
    context.output = responses
github Sceptre / sceptre / sceptre / cli / list.py View on Github external
List change sets for stack.
    \f

    :param path: Path to execute the command on.
    :type path: str
    """
    context = SceptreContext(
        command_path=path,
        project_path=ctx.obj.get("project_path"),
        user_variables=ctx.obj.get("user_variables"),
        output_format=ctx.obj.get("output_format"),
        options=ctx.obj.get("options"),
        ignore_dependencies=ctx.obj.get("ignore_dependencies")
    )

    plan = SceptrePlan(context)
    responses = [
        response for response
        in plan.list_change_sets().values() if response
    ]

    for response in responses:
        write(response, context.output_format)
github Sceptre / sceptre / sceptre / cli / describe.py View on Github external
\f

    :param path: Path to execute the command on.
    :type path: str
    """
    context = SceptreContext(
        command_path=path,
        project_path=ctx.obj.get("project_path"),
        user_variables=ctx.obj.get("user_variables"),
        options=ctx.obj.get("options"),
        output_format=ctx.obj.get("output_format"),
        no_colour=ctx.obj.get("no_colour"),
        ignore_dependencies=ctx.obj.get("ignore_dependencies")
    )

    plan = SceptrePlan(context)
    responses = plan.get_policy()
    for response in responses.values():
        write(
            response,
            context.output_format,
            context.no_colour
        )
github Sceptre / sceptre / sceptre / cli / template.py View on Github external
Prints the template used for stack in PATH.
    \f

    :param path: Path to execute the command on.
    :type path: str
    """
    context = SceptreContext(
        command_path=path,
        project_path=ctx.obj.get("project_path"),
        user_variables=ctx.obj.get("user_variables"),
        options=ctx.obj.get("options"),
        output_format=ctx.obj.get("output_format"),
        ignore_dependencies=ctx.obj.get("ignore_dependencies")
    )

    plan = SceptrePlan(context)
    responses = plan.generate()
    output = [template for template in responses.values()]
    write(output, context.output_format)
github Sceptre / sceptre / sceptre / cli / execute.py View on Github external
:param path: Path to execute the command on.
    :type path: str
    :param change_set_name: Change Set to use.
    :type change_set_name: str
    :param yes: A flag to answer 'yes' too all CLI questions.
    :type yes: bool
    """
    context = SceptreContext(
        command_path=path,
        project_path=ctx.obj.get("project_path"),
        user_variables=ctx.obj.get("user_variables"),
        options=ctx.obj.get("options"),
        ignore_dependencies=ctx.obj.get("ignore_dependencies")
    )

    plan = SceptrePlan(context)
    confirmation(
        plan.execute_change_set.__name__,
        yes,
        change_set=change_set_name,
        command_path=path
    )
    plan.execute_change_set(change_set_name)
github Sceptre / sceptre / sceptre / cli / describe.py View on Github external
:param change_set_name: Name of the Change Set to use.
    :type change_set_name: str
    :param verbose: A flag to display verbose output.
    :type verbose: bool
    """
    context = SceptreContext(
        command_path=path,
        project_path=ctx.obj.get("project_path"),
        user_variables=ctx.obj.get("user_variables"),
        options=ctx.obj.get("options"),
        output_format=ctx.obj.get("output_format"),
        no_colour=ctx.obj.get("no_colour"),
        ignore_dependencies=ctx.obj.get("ignore_dependencies")
    )

    plan = SceptrePlan(context)

    responses = plan.describe_change_set(change_set_name)
    for response in responses.values():
        description = response
        if not verbose:
            description = simplify_change_set_description(description)
        write(description, context.output_format, context.no_colour)
github Sceptre / sceptre / sceptre / cli / list.py View on Github external
:param path: Path to execute the command on.
    :type path: str
    :param export: Specify the export formatting.
    :type export: str
   """
    context = SceptreContext(
        command_path=path,
        project_path=ctx.obj.get("project_path", None),
        user_variables=ctx.obj.get("user_variables", {}),
        options=ctx.obj.get("options", {}),
        output_format=ctx.obj.get("output_format"),
        ignore_dependencies=ctx.obj.get("ignore_dependencies")
    )

    plan = SceptrePlan(context)
    responses = [
        response for response
        in plan.describe_outputs().values() if response
    ]

    if export == "envvar":
        for response in responses:
            for stack in response.values():
                for output in stack:
                    write("export SCEPTRE_{0}='{1}'".format(
                        output.get("OutputKey"),
                        output.get("OutputValue")
                    ), 'text')
    else:
        write(responses, context.output_format)