diff options
author | Martin Abente <martin.abente.lahaye@gmail.com> | 2011-03-23 18:48:00 (GMT) |
---|---|---|
committer | Martin Abente <martin.abente.lahaye@gmail.com> | 2011-03-23 18:48:00 (GMT) |
commit | 013e2327af4bf9c9d8545f4a7a865353f05a6614 (patch) | |
tree | 79109d8704db700feb32f460a5ffa80f4414d06d | |
parent | 8c9f737f995e4d232e5c58d2f09f46f46aca1c01 (diff) |
Robustness patch
-rwxr-xr-x | reports_mailer.py | 19 | ||||
-rw-r--r-- | sugar-fbserver.spec | 3 |
2 files changed, 13 insertions, 9 deletions
diff --git a/reports_mailer.py b/reports_mailer.py index a516d53..d81d703 100755 --- a/reports_mailer.py +++ b/reports_mailer.py @@ -76,12 +76,9 @@ def prepare_message(subject, body, report_path): return message -def generate_body(info, report_info_path): - body = json.dumps(info) +def generate_body(info_data, report_info_path): report_time = time.ctime(os.path.getctime(report_info_path)) - body += '\n\nReported at %s.' % report_time - - return body + return ('%s\n\nReported at %s.' % (info_data, report_time)) def generate_subject(info): if 'serial_number' in info: @@ -106,17 +103,23 @@ def check_reports(): continue report_info_file = open(report_info_path, 'r') - report_info = json.load(report_info_file) + report_data = report_info_file.read() report_info_file.close() - body = generate_body(report_info, report_info_path) + try: + report_info = json.loads(report_data) + except Exception, e: + print 'Error while parsing %s: %s' % (report_info_path, str(e)) + continue + + body = generate_body(report_data, report_info_path) subject = generate_subject(report_info) message = prepare_message(subject, body, report_path) try: send_email(message) except Exception, e: - print str(e) + print 'Error while sending %s: %s' % (report_info_path, str(e)) continue emailed_mark_file = open(emailed_mark_path, 'w') diff --git a/sugar-fbserver.spec b/sugar-fbserver.spec index 4a168a8..e786654 100644 --- a/sugar-fbserver.spec +++ b/sugar-fbserver.spec @@ -1,6 +1,6 @@ Name: sugar-fbserver Version: 0.2 -Release: 1 +Release: 2 Vendor: Activity Central Summary: Sugar debugging feedback server Group: Applications/Internet @@ -61,6 +61,7 @@ chkconfig --level 345 fbserverd off * Wed Mar 23 2011 Martin Abente. <martin.abente.lahaye@gmail.com> - Add feedback mailer script +- Robustness enhancements * Mon Mar 7 2011 Martin Abente. <martin.abente.lahaye@gmail.com> - Add pyOpenSSL dependency |