18903: handle deleted users properly.
authorWard Vandewege <ward@curii.com>
Fri, 25 Mar 2022 21:33:43 +0000 (17:33 -0400)
committerWard Vandewege <ward@curii.com>
Fri, 25 Mar 2022 21:33:43 +0000 (17:33 -0400)
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

tools/user-activity/arvados_user_activity/main.py

index 2f38db3beb00b2cd520075d0bac8bbb631a81294..3fcba5748b5b621513cf7ae2b2c51f9cc707e16b 100755 (executable)
@@ -33,7 +33,11 @@ def getowner(arv, uuid, owners):
     return getowner(arv, owners[uuid], owners)
 
 def getuserinfo(arv, uuid):
-    u = arv.users().get(uuid=uuid).execute()
+    try:
+        u = arv.users().get(uuid=uuid).execute()
+    except:
+        return "deleted user (%susers/%s)" % (arv.config()["Services"]["Workbench1"]["ExternalURL"],
+                                                       uuid)
     prof = "\n".join("  %s: \"%s\"" % (k, v) for k, v in u["prefs"].get("profile", {}).items() if v)
     if prof:
         prof = "\n"+prof+"\n"