Make restart argument work more reliably.
This commit is contained in:
parent
3835bd85b0
commit
608453c1de
|
@ -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))
|
||||
|
|
Reference in New Issue