From 73ea9264803bdf53a5da64992c1b91e94633f5e3 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 10 Oct 2016 16:32:27 +0800 Subject: [PATCH] tools/ceph_monstore_tool: bail out if no caps found for a key we take it as an error if no caps is granted to an entity in the specified keyring file when rebuilding the monitor db. Signed-off-by: Kefu Chai (cherry picked from commit b4bd4004a836121c11b0bb97d8123df54c271f04) --- src/tools/ceph_monstore_tool.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/ceph_monstore_tool.cc b/src/tools/ceph_monstore_tool.cc index a3916408b617d..e2aec2ae95b8c 100644 --- a/src/tools/ceph_monstore_tool.cc +++ b/src/tools/ceph_monstore_tool.cc @@ -532,6 +532,10 @@ static int update_auth(MonitorDBStore& st, const string& keyring_path) KeyServerData::Incremental auth_inc; auth_inc.name = k.first; auth_inc.auth = k.second; + if (auth_inc.auth.caps.empty()) { + cerr << "no caps granted to: " << auth_inc.name << std::endl; + return -EINVAL; + } auth_inc.op = KeyServerData::AUTH_INC_ADD; AuthMonitor::Incremental inc; -- 2.39.5