From ae6c7cb9363fa97d30d000516782968c82bdfea0 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Fri, 22 May 2015 07:28:21 +0000 Subject: [PATCH] --le-vhost-ext -> --apache-le-vhost-ext --- letsencrypt/cli.py | 4 +--- letsencrypt_apache/configurator.py | 10 +++++++--- letsencrypt_apache/constants.py | 1 + letsencrypt_apache/tests/util.py | 2 +- letsencrypt_nginx/tests/util.py | 3 +-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index defa7633d..ecf6764f7 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -318,13 +318,11 @@ def _paths_parser(parser): help=config_help("work_dir")) add("--backup-dir", default=flag_default("backup_dir"), help=config_help("backup_dir")) + add("--key-dir", default=flag_default("key_dir"), help=config_help("key_dir")) add("--cert-dir", default=flag_default("certs_dir"), help=config_help("cert_dir")) - - add("--le-vhost-ext", default="-le-ssl.conf", - help=config_help("le_vhost_ext")) add("--cert-path", default=flag_default("cert_path"), help=config_help("cert_path")) add("--chain-path", default=flag_default("chain_path"), diff --git a/letsencrypt_apache/configurator.py b/letsencrypt_apache/configurator.py index 102718e13..24ccb0859 100644 --- a/letsencrypt_apache/configurator.py +++ b/letsencrypt_apache/configurator.py @@ -97,6 +97,9 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): add("init-script", default=constants.CLI_DEFAULTS["init_script"], help="Path to the Apache init script (used for server " "reload/restart).") + add("le-vhost-ext", default=constants.CLI_DEFAULTS["le_vhost_ext"], + help="SSL vhost configuration extension.") + def __init__(self, *args, **kwargs): """Initialize an Apache Configurator. @@ -448,7 +451,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): """Makes an ssl_vhost version of a nonssl_vhost. Duplicates vhost and adds default ssl options - New vhost will reside as (nonssl_vhost.path) + ``IConfig.le_vhost_ext`` + New vhost will reside as (nonssl_vhost.path) + + ``letsencrypt_apache.constants.CLI_DEFAULTS["le_vhost_ext"]`` .. note:: This function saves the configuration @@ -462,9 +466,9 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): avail_fp = nonssl_vhost.filep # Get filepath of new ssl_vhost if avail_fp.endswith(".conf"): - ssl_fp = avail_fp[:-(len(".conf"))] + self.config.le_vhost_ext + ssl_fp = avail_fp[:-(len(".conf"))] + self.conf("le_vhost_ext") else: - ssl_fp = avail_fp + self.config.le_vhost_ext + ssl_fp = avail_fp + self.conf("le_vhost_ext") # First register the creation so that it is properly removed if # configuration is rolled back diff --git a/letsencrypt_apache/constants.py b/letsencrypt_apache/constants.py index b40e2ac65..865741823 100644 --- a/letsencrypt_apache/constants.py +++ b/letsencrypt_apache/constants.py @@ -8,6 +8,7 @@ CLI_DEFAULTS = dict( ctl="apache2ctl", enmod="a2enmod", init_script="/etc/init.d/apache2", + le_vhost_ext="-le-ssl.conf", ) """CLI defaults.""" diff --git a/letsencrypt_apache/tests/util.py b/letsencrypt_apache/tests/util.py index fc2dcfc79..e637b0890 100644 --- a/letsencrypt_apache/tests/util.py +++ b/letsencrypt_apache/tests/util.py @@ -75,7 +75,7 @@ def get_apache_configurator( config=mock.MagicMock( apache_server_root=config_path, apache_mod_ssl_conf=ssl_options, - le_vhost_ext="-le-ssl.conf", + apache_le_vhost_ext=constants.CLI_DEFAULTS["le_vhost_ext"], backup_dir=backups, config_dir=config_dir, temp_checkpoint_dir=os.path.join(work_dir, "temp_checkpoints"), diff --git a/letsencrypt_nginx/tests/util.py b/letsencrypt_nginx/tests/util.py index c53250f1b..45d1fa184 100644 --- a/letsencrypt_nginx/tests/util.py +++ b/letsencrypt_nginx/tests/util.py @@ -46,8 +46,7 @@ def get_nginx_configurator( config = configurator.NginxConfigurator( config=mock.MagicMock( nginx_server_root=config_path, nginx_mod_ssl_conf=ssl_options, - le_vhost_ext="-le-ssl.conf", backup_dir=backups, - config_dir=config_dir, work_dir=work_dir, + backup_dir=backups, config_dir=config_dir, work_dir=work_dir, temp_checkpoint_dir=os.path.join(work_dir, "temp_checkpoints"), in_progress_dir=os.path.join(backups, "IN_PROGRESS")), name="nginx",