rblanche: avoid crashing on deactivated users
authorAlex Dehnert <adehnert@mit.edu>
Sat, 12 Oct 2013 18:03:23 +0000 (14:03 -0400)
committerAlex Dehnert <adehnert@mit.edu>
Sat, 12 Oct 2013 18:03:23 +0000 (14:03 -0400)
When chpoboxing (-c), we get_pobox for each user. moira returns an error for
(some) deactivated users, so we should catch that error and report it inline,
rather than erroring out entirely. This was discovered by rblanche'ing
sipb-prospectives.

rblanche.py

index fb31a4272ed2bd1ca028f43d5edd33e654ac11a4..9eb995f186d891313665d52845a54ea9e99ca07f 100755 (executable)
@@ -33,7 +33,10 @@ class RBlanche(object):
         return members
 
     def get_and_format_pobox(self, user):
-        result = moira.query('get_pobox', user)[0]
+        try:
+            result = moira.query('get_pobox', user)[0]
+        except moira.MoiraException, e:
+            return "%8s ** moira error: %s **" % (user, e)
         if result['type'] == 'SMTP':
             fmt = '-> %s'
         elif result['type'] == 'SPLIT':