Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2010-06-03 14:25:27 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2010-06-03 14:25:27 (GMT)
commita491b9c33f8f2f73dcf6d806e568cbf135c99e60 (patch)
tree80e5f6a5a47637394257ac22c2cbfee4fe503884
parent5f55ac4504761203a32516dda9fb7c985a931d82 (diff)
convert data store errors (e.g. entry doesn't exist) into ENOENT
-rwxr-xr-xdatastore-fuse.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/datastore-fuse.py b/datastore-fuse.py
index dc080b1..ce9e4e2 100755
--- a/datastore-fuse.py
+++ b/datastore-fuse.py
@@ -231,8 +231,6 @@ class DataStoreFile(object):
self._dirty = False
self._path = path
- logging.debug('opening file %r with flags %r', path, flags)
-
# Contrary to what's documented in the wiki, we'll get passed O_CREAT
# and mknod() won't get called automatically, so we'll have to take
# care of all possible cases ourselves.
@@ -460,14 +458,15 @@ class DataStoreFS(fuse.Fuse):
mess = metadata.copy()
mess.update(options)
properties = mess.pop('metadata', [])
- logging.debug('mess=%r, properties=%r', mess, properties)
-
return self._data_store.find(mess, properties, timeout=-1,
byte_arrays=True)[0]
def get_metadata(self, object_id):
- return self._data_store.get_properties(object_id, timeout=-1,
- byte_arrays=True)
+ try:
+ return self._data_store.get_properties(object_id, timeout=-1,
+ byte_arrays=True)
+ except Exception, exception:
+ raise IOError(errno.ENOENT, str(exception))
def create_new(self, name, path):
base_name = os.path.splitext(name)[0]
@@ -481,16 +480,27 @@ class DataStoreFS(fuse.Fuse):
self._add_title_name(name, object_id)
def remove_entry(self, object_id):
- self._data_store.delete(object_id)
+ try:
+ self._data_store.delete(object_id)
+ except Exception, exception:
+ raise IOError(errno.ENOENT, str(exception))
+
self._remove_title_name_by_object_id(object_id)
self._truncate_object_ids.discard(object_id)
def get_data(self, object_id):
- return self._data_store.get_filename(object_id, timeout=-1,
- byte_arrays=True)
+ try:
+ return self._data_store.get_filename(object_id, timeout=-1,
+ byte_arrays=True)
+ except Exception, exception:
+ raise IOError(errno.ENOENT, str(exception))
def get_data_size(self, object_id):
- file_name = self.get_data(object_id)
+ try:
+ file_name = self.get_data(object_id)
+ except Exception, exception:
+ raise IOError(errno.ENOENT, str(exception))
+
if not file_name:
return 0