~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to scripts/script-monitor.py

  • Committer: Jeroen Vermeulen
  • Date: 2011-09-26 06:30:07 UTC
  • mto: This revision was merged to the branch mainline in revision 14049.
  • Revision ID: jeroen.vermeulen@canonical.com-20110926063007-1fb5eelnidpnra9a
Fix lots of lint in recently-changed files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        start_date = datetime.now() - timedelta(minutes=minutes_ago)
47
47
 
48
48
        completed_from = strftime("%Y-%m-%d %H:%M:%S", start_date.timetuple())
49
 
        completed_to = strftime("%Y-%m-%d %H:%M:%S", datetime.now().timetuple())
 
49
        completed_to = strftime(
 
50
            "%Y-%m-%d %H:%M:%S", datetime.now().timetuple())
50
51
 
51
52
        hosts_scripts = []
52
53
        for arg in args:
75
76
                subj.append("%s:%s" % (hostname, scriptname))
76
77
                error_found = 2
77
78
        if error_found:
78
 
            # Construct our email
 
79
            # Construct our email.
79
80
            msg = MIMEText('\n'.join(msg))
80
81
            msg['Subject'] = "Scripts failed to run: %s" % ", ".join(subj)
81
82
            msg['From'] = 'script-failures@launchpad.net'
82
83
            msg['Reply-To'] = 'launchpad@lists.canonical.com'
83
84
            msg['To'] = 'launchpad@lists.canonical.com'
84
85
 
85
 
            # Send out the email
 
86
            # Send out the email.
86
87
            smtp = smtplib.SMTP()
87
88
            smtp.connect()
88
 
            smtp.sendmail('script-failures@launchpad.net', ['launchpad@lists.canonical.com'], msg.as_string())
 
89
            smtp.sendmail(
 
90
                'script-failures@launchpad.net',
 
91
                ['launchpad@lists.canonical.com'], msg.as_string())
89
92
            smtp.close()
90
93
            return 2
91
94
    except: