def check_running_mount( tracker: ProblemTracker, instance: EdenInstance, checkout_info: CheckoutInfo, mount_table: mtab.MountTable, watchman_info: check_watchman.WatchmanCheckInfo, ) -> None: if checkout_info.configured_state_dir is None: tracker.add_problem(CheckoutNotConfigured(checkout_info)) return elif checkout_info.configured_state_dir != checkout_info.running_state_dir: tracker.add_problem(CheckoutConfigurationMismatch(checkout_info)) return checkout = checkout_info.get_checkout() try: config = checkout.get_config() except Exception as ex: tracker.add_problem(ConfigurationParsingProblem(checkout_info, ex)) # Just skip the remaining checks. # Most of them rely on values from the configuration. return check_filesystems.check_using_nfs_path(tracker, checkout.path) check_watchman.check_active_mount(tracker, str(checkout.path), watchman_info) check_redirections.check_redirections(tracker, instance, checkout, mount_table) if sys.platform == "win32": check_filesystems.check_materialized_are_accessible( tracker, instance, checkout) check_filesystems.check_loaded_content(tracker, instance, checkout, prjfs.PrjGetOnDiskFileState) if config.scm_type == "hg": check_hg.check_hg(tracker, checkout)
def __init__( self, out: ui.Output, checkout_info: CheckoutInfo, all_checkouts: List[CheckoutInfo], checked_backing_repos: Set[str], ) -> None: self._out = out self._instance = checkout_info.instance self._mount_path = checkout_info.path self._backing_repo = checkout_info.get_backing_repo() self._all_checkouts = all_checkouts self._checked_backing_repos = checked_backing_repos
def _get_checkouts_info(self) -> Dict[Path, CheckoutInfo]: checkouts: Dict[Path, CheckoutInfo] = {} # Get information about the checkouts currently known to the running # edenfs process with self.instance.get_thrift_client_legacy() as client: for mount in client.listMounts(): # Old versions of edenfs did not return a mount state field. # These versions only listed running mounts, so treat the mount state # as running in this case. mount_state = (mount.state if mount.state is not None else MountState.RUNNING) path = Path(os.fsdecode(mount.mountPoint)) checkout = CheckoutInfo( self.instance, path, backing_repo=Path(os.fsdecode(mount.backingRepoPath)) if mount.backingRepoPath is not None else None, running_state_dir=Path(os.fsdecode(mount.edenClientPath)), state=mount_state, ) checkouts[path] = checkout # Get information about the checkouts listed in the config file for configured_checkout in self.instance.get_checkouts(): checkout_info = checkouts.get(configured_checkout.path, None) if checkout_info is None: checkout_info = CheckoutInfo(self.instance, configured_checkout.path) checkout_info.configured_state_dir = configured_checkout.state_dir checkouts[checkout_info.path] = checkout_info if checkout_info.backing_repo is None: checkout_info.backing_repo = ( configured_checkout.get_config().backing_repo) checkout_info.configured_state_dir = configured_checkout.state_dir return checkouts
def check_mount_overlay_type(tracker: ProblemTracker, checkout_info: CheckoutInfo) -> None: config = checkout_info.get_checkout().get_config() if not config.enable_tree_overlay: tracker.add_problem(CheckoutLegacyOverlayType(checkout_info))