]> git.sesse.net Git - letsencrypt-hitch-plugin/blobdiff - hitch.py
Small update for certbot in bookworm.
[letsencrypt-hitch-plugin] / hitch.py
index 89d682e951fda0ab69e09168ca42a20a712c3d57..edcaedda7a9885994121a5741607a30f7aa06eeb 100644 (file)
--- a/hitch.py
+++ b/hitch.py
@@ -4,21 +4,20 @@ import os
 import re
 import subprocess
 
-import zope.component
-import zope.interface
+from zope.interface import implementer, provider
 
-from letsencrypt import errors
-from letsencrypt import interfaces
-from letsencrypt.plugins import common
+from certbot import errors
+from certbot import interfaces
+from certbot.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
@@ -33,6 +32,10 @@ class Installer(common.Plugin):
     def get_all_names(self):
         raise errors.PluginError("not implemented")
 
+    @classmethod
+    def add_parser_arguments(cls, add):
+        pass
+
     def deploy_cert(self, domain, cert_path, key_path,
                     chain_path=None, fullchain_path=None):
         # Concatenate private key and certificate together into one file.
@@ -56,14 +59,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 +96,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):