Catch AFS exceptions
[invirt/packages/xvm-authz-locker.git] / python / xvm / authz / locker.py
index 59b480e..5945ab6 100644 (file)
@@ -3,6 +3,7 @@ import errno
 from afs import acl
 from afs import fs
 from afs import pts
+from afs import _util
 
 from invirt import common
 from invirt.config import structs as config
@@ -41,7 +42,7 @@ def expandOwner(name):
                 allowed.difference_update(_expandGroup(ent, cell=cell, auth=auth))
 
         return allowed
-    except OSError, e:
+    except (_util.AFSException, OSError), e:
         if e.errno in (errno.ENOENT, errno.EACCES):
             return []
         else:
@@ -113,6 +114,13 @@ def _expandGroup(name, cell=None, auth=False):
             return set([ent.name])
         else:
             return set([x.name for x in ent.members])
+    except _util.AFSException, e:
+        if e.errno in (267268, # User or group doesn't exist
+                       267269  # Permission denied
+                       ):
+            return set()
+        else:
+            raise
     except OSError, e:
         if e.errno in (errno.ENOENT, errno.EACCESS):
             return set()