From 9c00ba17627c2b3526c558564954b8bb1d8472ef 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 5699ec4c91977..151923e3e9f84 100644 --- a/src/tools/ceph_monstore_tool.cc +++ b/src/tools/ceph_monstore_tool.cc @@ -533,6 +533,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