X-Git-Url: https://git.sesse.net/?p=letsencrypt-hitch-plugin;a=blobdiff_plain;f=hitch.py;h=537e02cae7e180e3aacf7ad1136ed1f6593a6110;hp=89d682e951fda0ab69e09168ca42a20a712c3d57;hb=HEAD;hpb=1d7ddad995f9283220f50e22273ccbe55e62a604 diff --git a/hitch.py b/hitch.py index 89d682e..edcaedd 100644 --- 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):