Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors in acme provisioning #4648

merged 3 commits into from Feb 14, 2019
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+17 −6
Diff settings


Just for now

Copy path View file
@@ -0,0 +1,2 @@
Fix "TypeError: '>' not supported" when starting without an existing certificate.
Fix a bug where an existing certificate would be reprovisoned every day.
Copy path View file
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2019 New Vector Ltd
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,11 +15,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function

import gc
import logging
import os
import sys
import traceback

from six import iteritems

@@ -27,6 +29,7 @@

from twisted.application import service
from twisted.internet import defer, reactor
from twisted.python.failure import Failure
from twisted.web.resource import EncodingResourceWrapper, NoResource
from twisted.web.server import GzipEncoderFactory
from twisted.web.static import File
@@ -394,10 +397,10 @@ def do_acme():
# is less than our re-registration threshold.
provision = False

if (cert_days_remaining is None):
provision = True

if cert_days_remaining > hs.config.acme_reprovision_threshold:
if (
cert_days_remaining is None or
cert_days_remaining < hs.config.acme_reprovision_threshold
provision = True

if provision:
@@ -438,7 +441,11 @@ def start():
except Exception:
# Print the exception and bail out.
print("Error during startup:", file=sys.stderr)

# this gives better tracebacks than traceback.print_exc()

if reactor.running:
Copy path View file
@@ -242,3 +242,5 @@ def _log(event):
redirectStandardIO=not config.no_redirect_stdio,
if not config.no_redirect_stdio:
print("Redirected stdout/stderr to logs")
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.