]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph_monstore_tool: bail out if no caps found for a key
authorKefu Chai <kchai@redhat.com>
Mon, 10 Oct 2016 08:32:27 +0000 (16:32 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 22 Nov 2016 03:47:00 +0000 (11:47 +0800)
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 <kchai@redhat.com>
(cherry picked from commit b4bd4004a836121c11b0bb97d8123df54c271f04)

src/tools/ceph_monstore_tool.cc

index 5699ec4c919772fa810ddb0240edeb815f314850..151923e3e9f84cc87edaf8c08522b04a5f30b303 100644 (file)
@@ -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;