From: Tim Serong Date: Fri, 21 Apr 2017 06:04:05 +0000 (+1000) Subject: mgr: fix crash on set_config from python module with insufficient caps X-Git-Tag: v12.0.3~170^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1dc66c4aebbf7581fcc508af5e1820768553272d;p=ceph.git mgr: fix crash on set_config from python module with insufficient caps 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 --- diff --git a/src/mgr/PyModules.cc b/src/mgr/PyModules.cc index 6bb5384ec9be..335a9a0866a8 100644 --- a/src/mgr/PyModules.cc +++ b/src/mgr/PyModules.cc @@ -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 PyModules::get_commands()