Example #1
0
 def _get_workspace_timestamped(self, workspace_id: EntryID,
                                timestamp: DateTime):
     try:
         return self._timestamped_workspacefs[workspace_id][timestamp]
     except KeyError:
         try:
             self.user_fs.get_workspace(workspace_id)
             raise MountpointNotMounted(
                 f"Workspace `{workspace_id}` not mounted at timestamped `{timestamp}`"
             )
         except FSWorkspaceNotFoundError as exc:
             raise MountpointConfigurationError(
                 f"Workspace `{workspace_id}` doesn't exist") from exc
Example #2
0
def _bootstrap_mountpoint(mountpoint):
    if os.name == "posix":
        # On POSIX systems, mounting target must exists
        mountpoint.mkdir(exist_ok=True, parents=True)
        initial_st_dev = mountpoint.stat().st_dev
    else:
        # On Windows, only parent's mounting target must exists
        mountpoint.parent.mkdir(exist_ok=True, parents=True)
        if mountpoint.exists():
            raise MountpointConfigurationError(
                f"Mountpoint `{mountpoint.absolute()}` must not exists on windows"
            )
        initial_st_dev = None

    return initial_st_dev
Example #3
0
def _bootstrap_mountpoint(mountpoint):
    try:
        if os.name == "posix":
            # On POSIX systems, mounting target must exists
            mountpoint.mkdir(exist_ok=True, parents=True)
            initial_st_dev = mountpoint.stat().st_dev
        else:
            # On Windows, only parent's mounting target must exists
            mountpoint.parent.mkdir(exist_ok=True, parents=True)
            if mountpoint.exists():
                raise MountpointConfigurationError(
                    f"Mountpoint `{mountpoint.absolute()}` must not exists on windows"
                )
            initial_st_dev = None

    except OSError as exc:
        # In case of hard crash, it's possible the FUSE mountpoint is still
        # mounted (but point to nothing). In such case access to the mountpoint
        # end up with an error :(
        raise MountpointConfigurationError(
            "Mountpoint is busy, has parsec prevously cleanly exited ?"
        ) from exc

    return initial_st_dev
Example #4
0
 def _get_workspace(self, workspace_id: EntryID):
     try:
         return self.user_fs.get_workspace(workspace_id)
     except FSWorkspaceNotFoundError as exc:
         raise MountpointConfigurationError(
             f"Workspace `{workspace_id}` doesn't exist") from exc