From: Kefu Chai Date: Mon, 10 Oct 2016 08:32:27 +0000 (+0800) Subject: tools/ceph_monstore_tool: bail out if no caps found for a key X-Git-Tag: v10.2.4~41^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=73ea9264803bdf53a5da64992c1b91e94633f5e3;p=ceph.git 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) --- 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;