outage-mail: make subject line an option
authorGreg Price <price@mit.edu>
Thu, 26 Mar 2009 05:32:15 +0000 (01:32 -0400)
committerGreg Price <price@mit.edu>
Thu, 26 Mar 2009 05:32:15 +0000 (01:32 -0400)
svn path=/trunk/scripts/outage/; revision=2275

outage-mail

index 93bb5a1..84ba26e 100644 (file)
@@ -20,7 +20,7 @@ def send_mail(smtp, opts, message, vm):
     msg['CC'] = 'XVM <xvm@mit.edu>'
     msg['Reply-To'] = 'XVM <xvm@mit.edu>'
     msg['From'] = opts.from_addr
     msg['CC'] = 'XVM <xvm@mit.edu>'
     msg['Reply-To'] = 'XVM <xvm@mit.edu>'
     msg['From'] = opts.from_addr
-    msg['Subject'] = '[xvm] Unexpected reboot of your VM %s' % vm
+    msg['Subject'] = opts.subject % vm
     smtp.sendmail(opts.from_addr,
         [contact, 'xvm@mit.edu'],
         msg.as_string())
     smtp.sendmail(opts.from_addr,
         [contact, 'xvm@mit.edu'],
         msg.as_string())
@@ -33,6 +33,11 @@ def main(argv):
             type = 'string',
             dest = 'message',
             help = 'filename with body of message')
             type = 'string',
             dest = 'message',
             help = 'filename with body of message')
+    parser.add_option('-s', '--subject',
+            type = 'string',
+            dest = 'subject',
+            default = '[xvm] Unexpected reboot of your VM %s',
+            help = 'subject line of message; %s for VM name')
     parser.add_option('-f', '--from',
             type = 'string',
             dest = 'from_addr',
     parser.add_option('-f', '--from',
             type = 'string',
             dest = 'from_addr',