예제 #1
0
파일: list.py 프로젝트: isotoma/sceptre
def list_outputs(ctx, path, export):
    """
    List outputs for stack.

    :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", {}))

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

    if export == "envvar":
        write("\n".join("export SCEPTRE_{0}={1}".format(
            output["OutputKey"], output["OutputValue"])
                        for response in responses for output in response))
    else:
        write(list(responses), context.output_format)
예제 #2
0
def list_outputs(ctx, path, export):
    """
    List outputs for stack.
    \f

    :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)