Handle FUSE unavailability correctly

master
Sven Slootweg 11 years ago
parent 79f4343296
commit 8162c8bb36

@ -283,17 +283,26 @@ class Directory:
fs = TahoeLAFS(self.uri, webapi=self.filesystem.url) fs = TahoeLAFS(self.uri, webapi=self.filesystem.url)
mount_failed = False
try: try:
return fuse.mount(fs, mountpoint) return fuse.mount(fs, mountpoint)
except OSError: except OSError:
mount_failed = True
except NameError:
mount_failed = True
except RuntimeError, e:
raise MountException("Could not mount the directory because a FUSE error was encountered: %s" % e.message)
if mount_failed:
try: try:
return dokan.mount(fs, mountpoint) return dokan.mount(fs, mountpoint)
except OSError: except OSError:
raise DependencyException("Could not mount the directory because both the FUSE and dokan libraries are unavailable.") raise DependencyException("Could not mount the directory because both the FUSE and dokan libraries are unavailable.")
except NameError:
raise DependencyException("Could not mount the directory because both the FUSE and dokan libraries are unavailable.")
except RuntimeError, e: except RuntimeError, e:
raise MountException("Could not mount the directory because a dokan error was encountered: %s" % e.message) raise MountException("Could not mount the directory because a dokan error was encountered: %s" % e.message)
except RuntimeError, e:
raise MountException("Could not mount the directory because a FUSE error was encountered: %s" % e.message)
def upload(self, filedata, filename=None): def upload(self, filedata, filename=None):
"""Upload a file to the storage grid and return a File object representing it. """Upload a file to the storage grid and return a File object representing it.

Loading…
Cancel
Save