]> git.sesse.net Git - letsencrypt-hitch-plugin/commitdiff
Translate to python3
authorHerman Øie Kolden <herman@samfundet.no>
Wed, 31 Oct 2018 20:34:43 +0000 (21:34 +0100)
committerHerman Øie Kolden <herman@samfundet.no>
Wed, 31 Oct 2018 20:34:43 +0000 (21:34 +0100)
hitch.py

index 89d682e951fda0ab69e09168ca42a20a712c3d57..537e02cae7e180e3aacf7ad1136ed1f6593a6110 100644 (file)
--- 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):