if "$@"; then return 1; else return 0; fi
}
-# some of the commands are just not idempotent.
-function without_test_dup_command()
-{
- if [ -z ${CEPH_CLI_TEST_DUP_COMMAND+x} ]; then
- $@
- else
- local saved=${CEPH_CLI_TEST_DUP_COMMAND}
- unset CEPH_CLI_TEST_DUP_COMMAND
- $@
- CEPH_CLI_TEST_DUP_COMMAND=saved
- fi
-}
-
ceph config dump
# value validation
ceph config rm mon debug_asok
ceph config get mon.a debug_asok | grep 33
ceph config rm global debug_asok
-without_test_dup_command ceph config reset
-ceph config get mon.a debug_asok | grep 33
-without_test_dup_command ceph config reset
# help
ceph config help debug_asok | grep debug_asok
expect_false grep debug_asok $t2
rm -f $t1 $t2
+expect_false ceph config reset
+expect_false ceph config reset -1
+# we are at end of testing, so it's okay to revert everything
+ceph config reset 0
+
echo OK
}
goto update;
} else if (prefix == "config reset") {
- int64_t num = -1;
- cmd_getval(g_ceph_context, cmdmap, "num", num);
- int64_t revert_to = num;
- if (revert_to < 0) // revert to last version
- revert_to = version - 1;
- if (revert_to > (int64_t)version) {
+ int64_t revert_to = -1;
+ cmd_getval(g_ceph_context, cmdmap, "num", revert_to);
+ if (revert_to < 0 ||
+ revert_to > (int64_t)version) {
err = -EINVAL;
ss << "must specify a valid historical version to revert to; "
<< "see 'ceph config log' for a list of avialable configuration "
"Show recent history of config changes",
"config", "r")
COMMAND("config reset " \
- "name=num,type=CephInt,range=0,req=False",
- "Revert configuration to a historical version specified by <num>, "
- "or simply revert to last version",
+ "name=num,type=CephInt,range=0",
+ "Revert configuration to a historical version specified by <num>",
"config", "rw")
COMMAND("config generate-minimal-conf",
"Generate a minimal ceph.conf file",