zephyr_mirror: Make the logging options require the log path as an argument.

This is for supporting running the mirroring bot on a server without
AFS.

(imported from commit 400bf32f17aca984fa40c3b1222893214497eaa0)
This commit is contained in:
Tim Abbott 2012-11-07 14:11:33 -05:00
parent 6caf52867f
commit c945d60d16

View file

@ -310,8 +310,8 @@ def zephyr_to_humbug(options):
if subscribed_to_mail_messages(): if subscribed_to_mail_messages():
zephyr_subscribe_autoretry(("mail", "inbox", "%me%")) zephyr_subscribe_autoretry(("mail", "inbox", "%me%"))
if options.resend_log: if options.resend_log_path is not None:
with open('/mit/tabbott/Private/zephyrs', 'r') as log: with open(options.resend_log_path, 'r') as log:
for ln in log: for ln in log:
try: try:
zeph = simplejson.loads(ln) zeph = simplejson.loads(ln)
@ -338,8 +338,8 @@ def zephyr_to_humbug(options):
print "%s: zephyr=>humbug: Starting receive loop." % (datetime.datetime.now(),) print "%s: zephyr=>humbug: Starting receive loop." % (datetime.datetime.now(),)
if options.enable_log: if options.log_path is not None:
log_file = "/mit/tabbott/Private/zephyrs" log_file = options.log_path
else: else:
log_file = "/dev/null" log_file = "/dev/null"
@ -546,15 +546,15 @@ if __name__ == "__main__":
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,
action='store_true') action='store_true')
parser.add_option('--resend-log', parser.add_option('--resend-log',
dest='resend_log', dest='resend_log_path',
default=False, default=None,
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,
action='store_true') action='store')
parser.add_option('--enable-log', parser.add_option('--enable-log',
dest='enable_log', dest='log_path',
default=False, default=None,
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,
action='store_true') action='store')
parser.add_option('--no-forward-personals', parser.add_option('--no-forward-personals',
dest='forward_personals', dest='forward_personals',
help=optparse.SUPPRESS_HELP, help=optparse.SUPPRESS_HELP,