expect_config_value "mon.a" "mon_pg_warn_min_objects" 10240
ceph tell mon.a injectargs '--mon_pg_warn_min_objects 1G'
expect_config_value "mon.a" "mon_pg_warn_min_objects" 1073741824
- # < /dev/null accounts for the fact that ceph will go in interactive mode
- # because injectargs is discarded (actually saved for the benefit of
- # a tell command that never comes)
- expect_false ceph injectargs mon.a '--mon_pg_warn_min_objects 10F' < /dev/null 2> /dev/null
+ expect_false ceph tell mon.a injectargs '--mon_pg_warn_min_objects 10F'
$SUDO ceph daemon mon.a config set mon_pg_warn_min_objects $initial_value
}
# (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
+ # script mode
+ echo 'auth del client.xx' | ceph
+ expect_false ceph auth get client.xx
#
# get / set auid
PROMPT = 'ceph> '
+if sys.stdin.isatty():
+ def read_input():
+ while True:
+ line = raw_input(PROMPT).rstrip()
+ if line in ['q', 'quit', 'Q']:
+ return None
+ if line:
+ return line
+else:
+ def read_input():
+ while True:
+ line = sys.stdin.readline()
+ if not line:
+ return None
+ line = line.rstrip()
+ if line:
+ return line
+
+
def new_style_command(parsed_args, cmdargs, target, sigdict, inbuf, verbose):
"""
Do new-style command dance.
else:
return -errno.EINVAL, '', 'invalid command'
else:
- # do the command-interpreter looping
- # for raw_input to do readline cmd editing
- import readline
-
if sys.stdin.isatty():
- prompt = PROMPT
- else:
- prompt = ''
+ # do the command-interpreter looping
+ # for raw_input to do readline cmd editing
+ import readline
while True:
- interactive_input = raw_input(prompt)
- if interactive_input in ['q', 'quit', 'Q']:
+ interactive_input = read_input()
+ if interactive_input is None:
return 0, '', ''
cmdargs = parse_cmdargs(shlex.split(interactive_input))[2]
try: