From fce08ea30c0dc60cb49761a2b0108c6481f09daa Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Fri, 8 May 2015 21:32:13 +0000 Subject: [PATCH] Use CLI_DEFAULTS in plugins --- letsencrypt/client/plugins/apache/configurator.py | 10 +++++----- letsencrypt/client/plugins/apache/constants.py | 14 ++++++++------ letsencrypt/client/plugins/nginx/configurator.py | 6 +++--- letsencrypt/client/plugins/nginx/constants.py | 9 ++++++--- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/letsencrypt/client/plugins/apache/configurator.py b/letsencrypt/client/plugins/apache/configurator.py index 3bc545475..82d6f323c 100644 --- a/letsencrypt/client/plugins/apache/configurator.py +++ b/letsencrypt/client/plugins/apache/configurator.py @@ -86,16 +86,16 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): @classmethod def add_parser_arguments(cls, add): - add("server-root", default=constants.DEFAULT_SERVER_ROOT, + add("server-root", default=constants.CLI_DEFAULTS["server_root"], help="Apache server root directory.") - add("mod-ssl-conf", default=constants.DEFAULT_MOD_SSL_CONF, + add("mod-ssl-conf", default=constants.CLI_DEFAULTS["mod_ssl_conf"], help="Contains standard Apache SSL directives.") - add("ctl", default=constants.DEFAULT_CTL, + add("ctl", default=constants.CLI_DEFAULTS["ctl"], help="Path to the 'apache2ctl' binary, used for 'configtest' and " "retrieving Apache2 version number.") - add("enmod", default=constants.DEFAULT_ENMOD, + add("enmod", default=constants.CLI_DEFAULTS["enmod"], help="Path to the Apache 'a2enmod' binary.") - add("init-script", default=constants.DEFAULT_INIT_SCRIPT, + add("init-script", default=constants.CLI_DEFAULTS["init_script"], help="Path to the Apache init script (used for server " "reload/restart).") diff --git a/letsencrypt/client/plugins/apache/constants.py b/letsencrypt/client/plugins/apache/constants.py index 63b3bd148..d9f2a0b9d 100644 --- a/letsencrypt/client/plugins/apache/constants.py +++ b/letsencrypt/client/plugins/apache/constants.py @@ -2,12 +2,14 @@ import pkg_resources -# CLI/IConfig defaults -DEFAULT_SERVER_ROOT = "/etc/apache2" -DEFAULT_MOD_SSL_CONF = "/etc/letsencrypt/options-ssl.conf" -DEFAULT_CTL = "apache2ctl" -DEFAULT_ENMOD = "a2enmod" -DEFAULT_INIT_SCRIPT = "/etc/init.d/apache2" +CLI_DEFAULTS = dict( + server_root="/etc/apache2", + mod_ssl_conf="/etc/letsencrypt/options-ssl.conf", + ctl="apache2ctl", + enmod="a2enmod", + init_script="/etc/init.d/apache2", +) +"""CLI defaults.""" MOD_SSL_CONF = pkg_resources.resource_filename( diff --git a/letsencrypt/client/plugins/nginx/configurator.py b/letsencrypt/client/plugins/nginx/configurator.py index 660653efa..49d5a6dd0 100644 --- a/letsencrypt/client/plugins/nginx/configurator.py +++ b/letsencrypt/client/plugins/nginx/configurator.py @@ -55,11 +55,11 @@ class NginxConfigurator(common.Plugin): @classmethod def add_parser_arguments(cls, add): - add("server-root", default=constants.DEFAULT_SERVER_ROOT, + add("server-root", default=constants.CLI_DEFAULTS["server_root"], help="Nginx server root directory.") - add("mod-ssl-conf", default=constants.DEFAULT_MOD_SSL_CONF, + add("mod-ssl-conf", default=constants.CLI_DEFAULTS["mod_ssl_conf"], help="Contains standard nginx SSL directives.") - add("ctl", default=constants.DEFAULT_CTL, help="Path to the " + add("ctl", default=constants.CLI_DEFAULTS["ctl"], help="Path to the " "'nginx' binary, used for 'configtest' and retrieving nginx " "version number.") diff --git a/letsencrypt/client/plugins/nginx/constants.py b/letsencrypt/client/plugins/nginx/constants.py index 51fff39e1..17d05f438 100644 --- a/letsencrypt/client/plugins/nginx/constants.py +++ b/letsencrypt/client/plugins/nginx/constants.py @@ -2,9 +2,12 @@ import pkg_resources -DEFAULT_SERVER_ROOT = "/etc/nginx" -DEFAULT_MOD_SSL_CONF = "/etc/letsencrypt/options-ssl-nginx.conf" -DEFAULT_CTL = "nginx" +CLI_DEFAULTS = dict( + server_root="/etc/nginx", + mod_ssl_conf="/etc/letsencrypt/options-ssl-nginx.conf", + ctl="nginx", +) +"""CLI defaults.""" MOD_SSL_CONF = pkg_resources.resource_filename(