From: Kefu Chai Date: Thu, 23 Apr 2015 16:50:37 +0000 (+0800) Subject: ceph.in: parse quote correctly in interactive mode X-Git-Tag: v0.94.3~47^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eb26388cb985456e8f6e07a52a20fa912cf4efaa;p=ceph.git ceph.in: parse quote correctly in interactive mode Fixes: #11279 Signed-off-by: Kefu Chai (cherry picked from commit bc7d8c99d2e16a141a8b575281ba12c67628dac3) --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 906c89289038..1af5e4b5f695 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 53f808733373..017efbca9359 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: