Use shlex for command splitting
This will preserve quoted strings, required for the rbd lock commands.
This commit is contained in:
parent
a2a630f6a0
commit
0ff2d7d537
|
@ -25,13 +25,14 @@ import threading
|
||||||
import signal
|
import signal
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import shlex
|
||||||
|
|
||||||
import pvcd.log as log
|
import pvcd.log as log
|
||||||
import pvcd.zkhandler as zkhandler
|
import pvcd.zkhandler as zkhandler
|
||||||
|
|
||||||
class OSDaemon(object):
|
class OSDaemon(object):
|
||||||
def __init__(self, command_string, environment, logfile):
|
def __init__(self, command_string, environment, logfile):
|
||||||
command = command_string.split()
|
command = shlex.split(command_string)
|
||||||
# Set stdout to be a logfile if set
|
# Set stdout to be a logfile if set
|
||||||
if logfile:
|
if logfile:
|
||||||
stdout = open(logfile, 'a')
|
stdout = open(logfile, 'a')
|
||||||
|
@ -62,7 +63,7 @@ def run_os_daemon(command_string, environment=None, logfile=None):
|
||||||
|
|
||||||
# Run a oneshot command, optionally without blocking
|
# Run a oneshot command, optionally without blocking
|
||||||
def run_os_command(command_string, background=False, environment=None, timeout=None):
|
def run_os_command(command_string, background=False, environment=None, timeout=None):
|
||||||
command = command_string.split()
|
command = shlex.split(command_string)
|
||||||
if background:
|
if background:
|
||||||
def runcmd():
|
def runcmd():
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue