From 0ff2d7d537ca959e06da255fc076bf3cf4847afc Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 7 Aug 2019 14:02:57 -0400 Subject: [PATCH] Use shlex for command splitting This will preserve quoted strings, required for the rbd lock commands. --- node-daemon/pvcd/common.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/node-daemon/pvcd/common.py b/node-daemon/pvcd/common.py index 810acb9f..f7840c2d 100644 --- a/node-daemon/pvcd/common.py +++ b/node-daemon/pvcd/common.py @@ -25,13 +25,14 @@ import threading import signal import os import time +import shlex import pvcd.log as log import pvcd.zkhandler as zkhandler class OSDaemon(object): def __init__(self, command_string, environment, logfile): - command = command_string.split() + command = shlex.split(command_string) # Set stdout to be a logfile if set if logfile: 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 def run_os_command(command_string, background=False, environment=None, timeout=None): - command = command_string.split() + command = shlex.split(command_string) if background: def runcmd(): try: