]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: fix crash on set_config from python module with insufficient caps 14706/head
authorTim Serong <tserong@suse.com>
Fri, 21 Apr 2017 06:04:05 +0000 (16:04 +1000)
committerTim Serong <tserong@suse.com>
Mon, 24 Apr 2017 10:15:02 +0000 (20:15 +1000)
If config-key put fails, we now log the failure rather than asserting that
it must always succeed.

Fixes: http://tracker.ceph.com/issues/19629
Signed-off-by: Tim Serong <tserong@suse.com>
src/mgr/PyModules.cc

index 6bb5384ec9bea31f718d742f15d966ed17796410..335a9a0866a8d04d01bee6182caeff1bd3823f42 100644 (file)
@@ -544,8 +544,14 @@ void PyModules::set_config(const std::string &handle,
   }
   set_cmd.wait();
 
-  // FIXME: is config-key put ever allowed to fail?
-  assert(set_cmd.r == 0);
+  if (set_cmd.r != 0) {
+    // config-key put will fail if mgr's auth key has insufficient
+    // permission to set config keys
+    // FIXME: should this somehow raise an exception back into Python land?
+    dout(0) << "`config-key put " << global_key << " " << val << "` failed: "
+      << cpp_strerror(set_cmd.r) << dendl;
+    dout(0) << "mon returned " << set_cmd.r << ": " << set_cmd.outs << dendl;
+  }
 }
 
 std::vector<ModuleCommand> PyModules::get_commands()