Nicer error message on admin not being a group.
[invirt/packages/invirt-web.git] / code / validation.py
index 4886638..3f05017 100644 (file)
@@ -162,7 +162,10 @@ def testAdmin(user, admin, machine):
         if user in getafsgroups.getAfsGroupMembers(admin, 'athena.mit.edu'):
             return admin
     except getafsgroups.AfsProcessError, e:
-        raise InvalidInput('administrator', admin, str(e))
+        errmsg = str(e)
+        if errmsg.startswith("pts: User or group doesn't exist"):
+            errmsg = 'The group "%s" does not exist.' % admin
+        raise InvalidInput('administrator', admin, errmsg)
     #XXX Should we require that user is in the admin group?
     return admin