in antlir/nspawn_in_subvol/plugins/repo_plugins.py [0:0]
def _get_snapshot_dir(opts: _NspawnOpts, plugin_args: NspawnPluginArgs):
# Shadow RPM installers by default, when running as "root". It is ugly
# to condition this on "root", but in practice, it is a significant
# costs savings for non-root runs -- no need to start repo servers and
# shadow bind mounts that (`sudo` aside) would not get used.
if (
plugin_args.attach_antlir_dir != AttachAntlirDirMode.OFF
and not opts.layer.path(ANTLIR_DIR).exists()
and opts.subvolume_on_disk
# pyre-fixme[16]: `SubvolumeOnDisk` has no attribute
# `build_appliance_path`.
and opts.subvolume_on_disk.build_appliance_path
):
return (
opts.subvolume_on_disk.build_appliance_path
/ RPM_DEFAULT_SNAPSHOT_FOR_INSTALLER_DIR.strip_leading_slashes()
)
if plugin_args.attach_antlir_dir == AttachAntlirDirMode.EXPLICIT_ON:
raise AttachAntlirDirError(
"ERROR: Could not attach /__antlir__ dir. Please "
"check to make sure that you do not have an existing antlir "
"directory in your image, and that the image has a "
"discoverable build appliance (usually through its flavor)."
)
return opts.layer.path(RPM_DEFAULT_SNAPSHOT_FOR_INSTALLER_DIR)