Abstracted the -D DUMP_RUN_CFG command to use os specific one, defined in constants

This commit is contained in:
Joona Hoikkala 2015-12-22 10:32:18 +02:00
parent 9739a0f10e
commit 7b05d573f2
2 changed files with 7 additions and 3 deletions

View file

@ -7,7 +7,8 @@ CLI_DEFAULTS_DEBIAN = dict(
server_root="/etc/apache2",
vhost_root="/etc/apache2/sites-available",
ctl="apache2ctl",
version_cmd='apache2ctl -v',
version_cmd="apache2ctl -v",
define_cmd="apache2ctl -t -D DUMP_RUN_CFG",
enmod="a2enmod",
dismod="a2dismod",
le_vhost_ext="-le-ssl.conf",
@ -20,6 +21,7 @@ CLI_DEFAULTS_CENTOS = dict(
vhost_root="/etc/httpd/conf.d",
ctl="apachectl",
version_cmd="apachectl -v",
define_cmd="apachectl -t -D DUMP_RUN_CFG",
enmod=None,
dismod=None,
le_vhost_ext="-le-ssl.conf",
@ -32,6 +34,7 @@ CLI_DEFAULTS_GENTOO = dict(
vhost_root="/etc/apache2/vhosts.d",
ctl="apache2ctl",
version_cmd="/usr/sbin/apache2 -v",
define_cmd="/usr/sbin/apache2 -t -D DUMP_RUN_CFG",
enmod=None,
dismod=None,
le_vhost_ext="-le-ssl.conf",

View file

@ -8,6 +8,7 @@ import subprocess
from letsencrypt import errors
from letsencrypt_apache import constants
logger = logging.getLogger(__name__)
@ -108,7 +109,7 @@ class ApacheParser(object):
for match in matches:
if match.count("=") > 1:
logger.error("Unexpected number of equal signs in "
"apache2ctl -D DUMP_RUN_CFG")
"runtime config dump.")
raise errors.PluginError(
"Error parsing Apache runtime variables")
parts = match.partition("=")
@ -124,7 +125,7 @@ class ApacheParser(object):
"""
try:
proc = subprocess.Popen(
[ctl, "-t", "-D", "DUMP_RUN_CFG"],
constants.os_constant("define_cmd").split(" "),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()