Merge pull request #195 from FlorianFieber/develop

Fix certificate expiration scheduler
This commit is contained in:
Lance Stout 2012-08-19 10:11:17 -07:00
commit 7d382a2bfd

View file

@ -901,9 +901,15 @@ class XMLStream(object):
log.warn('CERT: Certificate has expired.') log.warn('CERT: Certificate has expired.')
restart() restart()
try:
total_seconds = cert_ttl.total_seconds()
except AttributeError:
# for Python < 2.7
total_seconds = (cert_ttl.microseconds + (cert_ttl.seconds + cert_ttl.days * 24 * 3600) * 10**6) / 10**6
log.info('CERT: Time until certificate expiration: %s' % cert_ttl) log.info('CERT: Time until certificate expiration: %s' % cert_ttl)
self.schedule('Certificate Expiration', self.schedule('Certificate Expiration',
cert_ttl.seconds, total_seconds,
restart) restart)
def _start_keepalive(self, event): def _start_keepalive(self, event):