scripts/rpc.py: fix pipe for whitespace separated list arguments

Ordinary python str.split() will by default split on each whitespace.
This includes arguments for rpc.py which expect a whitespace separated list,
eg. construct_raid_bdev -b "Bdev_1 Bdev_2".
shlex.split() prevents splitting on quoted arguments.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453652 (master)

(cherry picked from commit 22c3befd3d)
Change-Id: If37eb87cf82a161263f2b247baff5c8a77c43efc
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457222
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Karol Latecki 2019-05-08 12:01:16 +02:00 committed by Darek Stojaczyk
parent d5aeeaf2f7
commit 12466d1ae3

View File

@ -6,6 +6,7 @@ import logging
import argparse
import rpc
import sys
import shlex
try:
from shlex import quote
@ -1804,7 +1805,7 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
def execute_script(parser, client, fd):
for rpc_call in map(str.rstrip, fd):
args = parser.parse_args(rpc_call.split())
args = parser.parse_args(shlex.split(rpc_call))
args.client = client
call_rpc_func(args)