From 608453c1de00cb4a0b60725a3aa6145fecd98a8c Mon Sep 17 00:00:00 2001 From: Chris Snijder Date: Tue, 30 Aug 2016 15:00:49 +0200 Subject: [PATCH] Make restart argument work more reliably. --- certbot_haproxy/installer.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/certbot_haproxy/installer.py b/certbot_haproxy/installer.py index 635f1ed..bfdf1f9 100644 --- a/certbot_haproxy/installer.py +++ b/certbot_haproxy/installer.py @@ -31,6 +31,7 @@ import os import glob import subprocess import re +import shlex from distutils.version import StrictVersion from OpenSSL import crypto @@ -103,7 +104,7 @@ class HAProxyInstaller(common.Plugin): type=str, default=constants.os_constant('crt_directory') ) - add( + add( "haproxy-restart", help=( "Override the default command to restart haproxy." @@ -566,13 +567,12 @@ class HAProxyInstaller(common.Plugin): """ self.config_test() try: - # read the haproxy-restart command. per default this is an array - # if it is overwritten by the user, it is a string, so we have - # to split it over spaces. This works not correctly if a user - # has quoted arguments (with spaces) + # Read the haproxy-restart command. Per default this is an array + # if it is overwritten by the user, it is a string, so we have to + # split it over spaces. cmd = self.conf('haproxy-restart') if isinstance(cmd, basestring): - cmd = cmd.split() + cmd = shlex.split(cmd) util.run_script(cmd) except errors.SubprocessError as err: raise errors.MisconfigurationError(str(err))