From 1a3f65859f881ee50b07749d7128384be7aaac62 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herman=20=C3=98ie=20Kolden?= Date: Wed, 31 Oct 2018 21:34:43 +0100 Subject: [PATCH 1/1] Translate to python3 --- hitch.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hitch.py b/hitch.py index 89d682e..537e02c 100644 --- a/hitch.py +++ b/hitch.py @@ -5,7 +5,8 @@ import re import subprocess import zope.component -import zope.interface + +from zope.interface import implementer, provider from letsencrypt import errors from letsencrypt import interfaces @@ -15,10 +16,10 @@ from letsencrypt.plugins import common logger = logging.getLogger(__name__) +@implementer(interfaces.IInstaller) +@provider(interfaces.IPluginFactory) class Installer(common.Plugin): """Hitch installer.""" - zope.interface.implements(interfaces.IInstaller) - zope.interface.classProvides(interfaces.IPluginFactory) description = "Hitch Installer" hidden = True @@ -56,14 +57,14 @@ class Installer(common.Plugin): # Actually write the full file. filename = os.path.join(os.path.dirname(cert_path), "all.pem") - fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0600) + fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600) with os.fdopen(fd, 'w') as pem_file: pem_file.write(pem) # Now go check the config file to see if this file is already there. found = False last_pem_line = None - for line_num in xrange(len(self.config)): + for line_num in range(len(self.config)): m = re.match("^\s*pem-file\s*=\s*\"([^\"]+)\"", self.config[line_num]) if m: last_pem_line = line_num @@ -93,7 +94,7 @@ class Installer(common.Plugin): if temporary: raise errors.PluginError("temporary is not implemented") - with open("/etc/hitch/hitch.conf", "w") as config_file: + with open("/etc/hitch/hitch.conf", "w") as config_file: config_file.writelines(self.config) def rollback_checkpoints(self, rollback=1): -- 2.39.2