def drift_show(ctx, path): """ Show stack drift on deployed stacks. In the event that the stack does not exist, we return a StackResourceDriftStatus of STACK_DOES_NOT_EXIST. In the event that drift detection times out, we return a StackResourceDriftStatus of TIMED_OUT. The timeout is set at 5 minutes, a value that cannot be configured. """ 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.drift_show() output_format = "json" if context.output_format == "json" else "yaml" exit_status = 0 for stack, (status, response) in responses.items(): if status in BAD_STATUSES: exit_status += 1 response.pop("ResponseMetadata", None) write({stack.external_name: deserialize_json_properties(response)}, output_format) exit(exit_status)
def step_impl(context, stack_name): sceptre_context = SceptreContext(command_path=stack_name + '.yaml', project_path=context.sceptre_dir) sceptre_plan = SceptrePlan(sceptre_context) values = sceptre_plan.drift_show().values() context.output = list(values)