def _parser_add_debug_only_not_for_prod_opts()

in antlir/nspawn_in_subvol/args.py [0:0]


def _parser_add_debug_only_not_for_prod_opts(parser: argparse.ArgumentParser):
    "Keep in sync with `_NspawnDebugOnlyNotForProdOpts`"
    defaults = _NspawnDebugOnlyNotForProdOpts._field_defaults
    parser.add_argument("--debug", action="store_true", help="Log more")
    parser.add_argument(
        "--forward-tls-env",
        action="store_true",
        help="Forwards into the container any environment variables whose "
        "names start with THRIFT_TLS_. Note that it is the responsibility "
        "of the layer to ensure that the contained paths are valid.",
    )
    parser.add_argument(
        "--logs-tmpfs",
        action="store_true",
        help="Our production runtime always provides a user-writable `/logs` "
        "in the container. Passing this flag will cause us to create the "
        "mount-point at runtime, if it does not exist, and mount a `tmpfs` "
        "there. Unlike real container logs, we do not supply a persistent "
        "writable mount since that is guaranteed to break hermeticity and "
        "e.g. make somebody's image tests very hard to debug.",
    )
    parser.add_argument(
        "--snapshot-into",
        default=defaults["snapshot_into"],
        type=lambda x: Path.from_argparse(x) if x else None,
        help="Create a non-ephemeral snapshot of `--layer` at the specified "
        "non-existent path and prepare it to host an nspawn container. "
        "Defaults to empty, which makes the snapshot ephemeral.",
    )
    parser.add_argument(
        "--cap-net-admin",
        action="store_true",
        help="Adds CAP_NET_ADMIN capability. Needed to run ip.",
    )
    parser.add_argument(
        "--private-network",
        action="store_true",
        default=defaults["private_network"],
        help="Pass `--private-network` to `systemd-nspawn`. This defaults "
        "to true to (a) encourage hermeticity, (b) because this stops "
        "nspawn from writing to resolv.conf in the image.",
    )
    parser.add_argument(
        "--register",
        action="store_true",
        default=defaults["register"],
        help="Register this container instance with `sysytemd-machined`. This "
        "is useful for local debugging and should never be relied on for CI "
        "or Production since it requires a known working, ambient systemd.",
    )