From 1dc66c4aebbf7581fcc508af5e1820768553272d Mon Sep 17 00:00:00 2001 From: Tim Serong Date: Fri, 21 Apr 2017 16:04:05 +1000 Subject: [PATCH] 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 --- src/mgr/PyModules.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mgr/PyModules.cc b/src/mgr/PyModules.cc index 6bb5384ec9b..335a9a0866a 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() -- 2.39.5