From eb26388cb985456e8f6e07a52a20fa912cf4efaa Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 24 Apr 2015 00:50:37 +0800 Subject: [PATCH] ceph.in: parse quote correctly in interactive mode Fixes: #11279 Signed-off-by: Kefu Chai (cherry picked from commit bc7d8c99d2e16a141a8b575281ba12c67628dac3) --- qa/workunits/cephtool/test.sh | 7 +++++++ src/ceph.in | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 906c892890387..1af5e4b5f6951 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -433,6 +433,13 @@ function test_auth() diff authfile authfile2 rm authfile authfile2 ceph auth del client.xx + expect_false ceph auth get client.xx + + # (almost) interactive mode + echo -e 'auth add client.xx mon allow osd "allow *"\n' | ceph + ceph auth get client.xx + ceph auth del client.xx + # # get / set auid # diff --git a/src/ceph.in b/src/ceph.in index 53f808733373f..017efbca93590 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -62,6 +62,7 @@ import argparse import errno import json import rados +import shlex import signal import socket import string @@ -424,7 +425,7 @@ def new_style_command(parsed_args, cmdargs, target, sigdict, inbuf, verbose): interactive_input = raw_input(prompt) if interactive_input in ['q', 'quit', 'Q']: return 0, '', '' - cmdargs = parse_cmdargs(interactive_input.split())[2] + cmdargs = parse_cmdargs(shlex.split(interactive_input))[2] try: target = find_cmd_target(cmdargs) except Exception as e: -- 2.39.5