diff --git a/letsencrypt/client/augeas_configurator.py b/letsencrypt/client/augeas_configurator.py index 040fce388..6e4d54fb1 100644 --- a/letsencrypt/client/augeas_configurator.py +++ b/letsencrypt/client/augeas_configurator.py @@ -1,4 +1,4 @@ -import abc, os, sys, shutil, time +import os, sys, shutil, time from letsencrypt.client.configurator import Configurator import augeas @@ -16,54 +16,6 @@ class AugeasConfigurator(Configurator): self.aug = augeas.Augeas(flags=augeas.Augeas.NONE) self.save_notes = "" - def deploy_cert(self, vhost, cert, key , cert_chain=None): - raise Exception("Error: augeas Configurator class") - - - def choose_virtual_host(self, name): - """ - Chooses a virtual host based on a given domain name - """ - raise Exception("Error: augeas Configurator class") - - def get_all_names(self): - """ - Return all names found in the Configuration - """ - raise Exception("Error: augeas Configurator class") - - def enable_redirect(self, ssl_vhost): - """ - Makes all traffic redirect to the given ssl_vhost - ie. port 80 => 443 - """ - raise Exception("Error: augeas Configurator class") - - def enable_hsts(self, ssl_vhost): - """ - Enable HSTS on the given ssl_vhost - """ - raise Exception("Error: augeas Configurator class") - - def enable_ocsp_stapling(self, ssl_vhost): - """ - Enable OCSP stapling on given ssl_vhost - """ - raise Exception("Error: augeas Configurator class") - - def get_all_certs_keys(self): - """ - Retrieve all certs and keys set in configuration - return list of tuples with form [(cert, key, path)] - """ - raise Exception("Error: augeas Configurator class") - - def enable_site(self, vhost): - """ - Enable the site at the given vhost - """ - raise Exception("Error: augeas Configurator class") - def check_parsing_errors(self, lens): """ This function checks to see if Augeas was unable to parse any of the @@ -400,25 +352,3 @@ class AugeasConfigurator(Configurator): sys.exit(41) return True - - - - def config_test(self): - """ - Make sure the configuration is valid - """ - raise Exception("Error: augeas Configurator class") - - def restart(self): - """ - Restart or refresh the server content - """ - raise Exception("Error: augeas Configurator class") - - def perform(self, challenge): - """ Perform the challenge """ - raise Exception("Error: augeas Configurator class") - - def cleanup(self): - """ Clean up any challenge configurations """ - raise Exception("Error: augeas Configurator class") diff --git a/letsencrypt/client/configurator.py b/letsencrypt/client/configurator.py index 0219b1c6a..ba6a8f5bd 100644 --- a/letsencrypt/client/configurator.py +++ b/letsencrypt/client/configurator.py @@ -1,83 +1,55 @@ -# Note: abc requires python 2.6 so we may remove this before -# launch. This should help in the creation of other configurators while -# we develop though +"""Configurator.""" -import abc class Configurator(object): - """ + """Generic Let's Encrypt configurator. + Class represents all possible webservers and configuration editors This includes the generic webserver which wont have configuration files at all, but instead create a new process to handle the DVSNI and other challenges. """ - __metaclass__ = abc.ABCMeta - def __init__(self): - return - - @abc.abstractmethod def deploy_cert(self, vhost, cert, key , cert_chain=None): - return + raise NotImplementedError() - @abc.abstractmethod def choose_virtual_host(self, name): - """ - Chooses a virtual host based on a given domain name - """ - return + """Chooses a virtual host based on a given domain name.""" + raise NotImplementedError() - @abc.abstractmethod def get_all_names(self): - """ - Returns all names found in the Configuration - """ - return + """Returns all names found in the configuration.""" + raise NotImplementedError() - @abc.abstractmethod def enable_redirect(self, ssl_vhost): - """ - Makes all traffic redirect to the given ssl_vhost - ie. port 80 => 443 - """ - return + """Makes all traffic redirect to the given ssl_vhost (port 80 => 443).""" + raise NotImplementedError() - @abc.abstractmethod def enable_hsts(self, ssl_vhost): - """ - Enable HSTS on the given ssl_vhost - """ - return + """Enable HSTS on the given ssl_vhost.""" + raise NotImplementedError() - @abc.abstractmethod def enable_ocsp_stapling(self, ssl_vhost): - """ - Enable OCSP stapling on given ssl_vhost - """ - return + """Enable OCSP stapling on given ssl_vhost.""" + raise NotImplementedError() - @abc.abstractmethod def get_all_certs_keys(self): - """ - Retrieve all certs and keys set in configuration + """Retrieve all certs and keys set in configuration. + returns: list of tuples with form [(cert, key, path)] """ - return + raise NotImplementedError() - @abc.abstractmethod def enable_site(self, vhost): - """ - Enable the site at the given vhost - """ - return + """Enable the site at the given vhost.""" + raise NotImplementedError() - @abc.abstractmethod def save(self, title=None, temporary=False): - """ - Saves all changes to the configuration files, both - title and temporary are needed because a save may be - intended to be permanent, but the save is not ready - to be a full checkpoint + """Saves all changes to the configuration files. + + Both title and temporary are needed because a save may be + intended to be permanent, but the save is not ready to be a full + checkpoint title: string - The title of the save. If a title is given, the configuration will be saved as a new checkpoint @@ -86,49 +58,32 @@ class Configurator(object): temporary: boolean - Indicates whether the changes made will be quickly reversed in the future (challenges) """ - return + raise NotImplementedError() - @abc.abstractmethod def revert_challenge_config(self): - """ - This function should reload the users original configuration files - """ - return + """Reload the users original configuration files.""" + raise NotImplementedError() - @abc.abstractmethod def rollback_checkpoints(self, rollback = 1): - """ - Revert `rollback` number of configuration checkpoints - """ - return + """Revert `rollback` number of configuration checkpoints.""" + raise NotImplementedError() - @abc.abstractmethod def display_checkpoints(self): - """ - Display the saved configuration checkpoints - """ - return + """Display the saved configuration checkpoints.""" + raise NotImplementedError() - @abc.abstractmethod def config_test(self): - """ - Make sure the configuration is valid - """ - return + """Make sure the configuration is valid.""" + raise NotImplementedError() - @abc.abstractmethod def restart(self): - """ - Restart or refresh the server content - """ - return + """Restart or refresh the server content.""" + raise NotImplementedError() - @abc.abstractmethod def perform(self, chall_type, tup): - """ Perform the given challenge""" - return + """Perform the given challenge""" + raise NotImplementedError() - @abc.abstractmethod def cleanup(self): - """ Cleanup configuration changes from challenge """ - return + """Cleanup configuration changes from challenge.""" + raise NotImplementedError() diff --git a/letsencrypt/client/display.py b/letsencrypt/client/display.py index 00d992ab0..c0c430fab 100644 --- a/letsencrypt/client/display.py +++ b/letsencrypt/client/display.py @@ -1,5 +1,6 @@ import dialog + WIDTH = 72 HEIGHT = 20 @@ -13,18 +14,34 @@ class SingletonD(object): class Display(SingletonD): + """Generic display.""" + def generic_notification(self, message, width = WIDTH, height = HEIGHT): - raise Exception("Error no display defined") + raise NotImplementedError() + def generic_menu(self, message, choices, input_text = "", width = WIDTH, height = HEIGHT): - raise Exception("Error no display defined") + raise NotImplementedError() + def generic_input(self, message): - raise Exception("Error no display defined") + raise NotImplementedError() + def generic_yesno(self, message, yes_label = "Yes", no_label = "No"): - raise Exception("Error no display defined") + raise NotImplementedError() + def filter_names(self, names): - raise Exception("Error no display defined") + raise NotImplementedError() + def success_installation(self, domains): - raise Exception("Error no display defined") + raise NotImplementedError() + + def display_certs(self, certs): + raise NotImplementedError() + + def confirm_revocation(self, cert): + raise NotImplementedError() + + def more_info_cert(self, cert): + raise NotImplementedError() def gen_https_names(self, domains): """ @@ -43,12 +60,6 @@ class Display(SingletonD): return result - def display_certs(self, certs): - raise Exception("Error no display define") - - def confirm_revocation(self, cert): - raise Exception("Error no display defined") - def cert_info_frame(self, cert): text = "-" * (WIDTH - 4) + "\n" text += self.cert_info_string(cert) @@ -67,9 +78,6 @@ class Display(SingletonD): text += "Installed: %s\n" % cert["installed"] return text - def more_info_cert(self, cert): - raise Exception("Error no display defined") - class NcursesDisplay(Display): import dialog