| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2010 Chris Moyer http://coredumped.org/ | 2 # Copyright (c) 2010 Chris Moyer http://coredumped.org/ |
| 3 # | 3 # |
| 4 # Permission is hereby granted, free of charge, to any person obtaining a | 4 # Permission is hereby granted, free of charge, to any person obtaining a |
| 5 # copy of this software and associated documentation files (the | 5 # copy of this software and associated documentation files (the |
| 6 # "Software"), to deal in the Software without restriction, including | 6 # "Software"), to deal in the Software without restriction, including |
| 7 # without limitation the rights to use, copy, modify, merge, publish, dis- | 7 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 8 # tribute, sublicense, and/or sell copies of the Software, and to permit | 8 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 9 # persons to whom the Software is furnished to do so, subject to the fol- | 9 # persons to whom the Software is furnished to do so, subject to the fol- |
| 10 # lowing conditions: | 10 # lowing conditions: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 """ | 30 """ |
| 31 | 31 |
| 32 if __name__ == "__main__": | 32 if __name__ == "__main__": |
| 33 from boto.utils import notify | 33 from boto.utils import notify |
| 34 import sys | 34 import sys |
| 35 from optparse import OptionParser | 35 from optparse import OptionParser |
| 36 parser = OptionParser(version=VERSION, usage=usage) | 36 parser = OptionParser(version=VERSION, usage=usage) |
| 37 parser.add_option("-t", "--to", help="Optional to address to send to (defaul
t from your boto.cfg)", action="store", default=None, dest="to") | 37 parser.add_option("-t", "--to", help="Optional to address to send to (defaul
t from your boto.cfg)", action="store", default=None, dest="to") |
| 38 parser.add_option("-s", "--subject", help="Optional Subject to send this rep
ort as", action="store", default="Report", dest="subject") | 38 parser.add_option("-s", "--subject", help="Optional Subject to send this rep
ort as", action="store", default="Report", dest="subject") |
| 39 parser.add_option("-f", "--file", help="Optionally, read from a file instead
of STDIN", action="store", default=None, dest="file") | 39 parser.add_option("-f", "--file", help="Optionally, read from a file instead
of STDIN", action="store", default=None, dest="file") |
| 40 parser.add_option("--html", help="HTML Format the email", action="store_true
", default=False, dest="html") |
| 41 parser.add_option("--no-instance-id", help="If set, don't append the instanc
e id", action="store_false", default=True, dest="append_instance_id") |
| 40 | 42 |
| 41 (options, args) = parser.parse_args() | 43 (options, args) = parser.parse_args() |
| 42 if options.file: | 44 if options.file: |
| 43 body = open(options.file, 'r').read() | 45 body = open(options.file, 'r').read() |
| 44 else: | 46 else: |
| 45 body = sys.stdin.read() | 47 body = sys.stdin.read() |
| 46 | 48 |
| 47 notify(options.subject, body=body, to_string=options.to) | 49 if options.html: |
| 50 notify(options.subject, html_body=body, to_string=options.to, append_ins
tance_id=options.append_instance_id) |
| 51 else: |
| 52 notify(options.subject, body=body, to_string=options.to, append_instance
_id=options.append_instance_id) |
| OLD | NEW |