From: Sage Weil Date: Tue, 17 Mar 2020 02:05:21 +0000 (-0500) Subject: mon/MgrMonitor: make 'mgr fail' work with no arguments X-Git-Tag: v15.2.0~33^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33997%2Fhead;p=ceph.git mon/MgrMonitor: make 'mgr fail' work with no arguments Fail the active mgr so you don't have to check ceph -s and cut&paste it or do some jq shenanigans with 'mgr dump'. Signed-off-by: Sage Weil --- diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index 397c3700c21d7..ef126edd65222 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -1051,7 +1051,13 @@ bool MgrMonitor::prepare_command(MonOpRequestRef op) if (prefix == "mgr fail") { string who; - cmd_getval(cmdmap, "who", who); + if (!cmd_getval(cmdmap, "who", who)) { + if (!map.active_gid) { + ss << "Currently no active mgr"; + goto out; + } + who = map.active_name; + } std::string err; uint64_t gid = strict_strtol(who.c_str(), 10, &err);