From 2249b18081284f849e8ba735e2169ec45ffba58b Mon Sep 17 00:00:00 2001
From: Tim Abbott <tabbott@zulip.com>
Date: Mon, 26 Aug 2013 14:50:30 -0400
Subject: [PATCH] zephyr_mirror: Ignore expired Kerberos tickets for personals
 mirror.

(imported from commit 094755feacd299255f078432465f11a609df9aef)
---
 bots/zephyr_mirror_backend.py      | 5 +++++
 bots/zmirror_private.conf.template | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py
index 6af07858..90a73e49 100755
--- a/bots/zephyr_mirror_backend.py
+++ b/bots/zephyr_mirror_backend.py
@@ -680,6 +680,8 @@ returned the following warning:
         # just notify the user that they need to renew their tickets
         (code, stderr) = send_unauthed_zephyr(zwrite_args, wrapped_content)
         if code == 0:
+            if options.ignore_expired_tickets:
+                return
             return send_error_zulip("""%s
 
 Your last message was forwarded from Zulip to Zephyr unauthenticated, \
@@ -941,6 +943,9 @@ def parse_args():
     parser.add_option('--sync-subscriptions',
                       default=False,
                       action='store_true')
+    parser.add_option('--ignore-expired-tickets',
+                      default=False,
+                      action='store_true')
     parser.add_option('--site',
                       default=DEFAULT_SITE,
                       help=optparse.SUPPRESS_HELP)
diff --git a/bots/zmirror_private.conf.template b/bots/zmirror_private.conf.template
index cb84e26f..e1bf5d55 100644
--- a/bots/zmirror_private.conf.template
+++ b/bots/zmirror_private.conf.template
@@ -1,5 +1,5 @@
 [program:zmirror-USERNAME]
-command=python /home/humbug/humbug/bots/zephyr_mirror_backend.py --root-path=/home/humbug/humbug/bots --user=USERNAME --enable-log=/home/humbug/logs/mirror-log-%(program_name)s --use-sessions --session-path=/home/humbug/zephyr_sessions/%(program_name)s --api-key-file=/home/humbug/api-keys/%(program_name)s
+command=python /home/humbug/humbug/bots/zephyr_mirror_backend.py --root-path=/home/humbug/humbug/bots --user=USERNAME --enable-log=/home/humbug/logs/mirror-log-%(program_name)s --use-sessions --session-path=/home/humbug/zephyr_sessions/%(program_name)s --api-key-file=/home/humbug/api-keys/%(program_name)s --ignore-expired-tickets
 priority=200                   ; the relative start priority (default 999)
 autostart=true                 ; start at supervisord start (default: true)
 autorestart=true               ; whether/when to restart (default: unexpected)