From: Tim Serong Date: Fri, 24 Mar 2017 15:38:19 +0000 (+0100) Subject: mgr: fix crash on missing 'ceph_version' in daemon metadata X-Git-Tag: v12.0.2~287^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=37e7029ac4282502e06069fff660d15492a9bf2e;p=ceph.git mgr: fix crash on missing 'ceph_version' in daemon metadata Prior to 1a331234e8, only OSDs had the Ceph version in their metadata (MONs and MDSes didn't). This commit searches for ceph_version, and if not present just returns an empty string. Fixes: http://tracker.ceph.com/issues/18764 Signed-off-by: Tim Serong --- diff --git a/src/mgr/PyModules.cc b/src/mgr/PyModules.cc index a4ddcda38c199..72eda5e58cde4 100644 --- a/src/mgr/PyModules.cc +++ b/src/mgr/PyModules.cc @@ -48,7 +48,10 @@ void PyModules::dump_server(const std::string &hostname, // TODO: pick the highest version, and make sure that // somewhere else (during health reporting?) we are // indicating to the user if we see mixed versions - ceph_version = i.second->metadata.at("ceph_version"); + auto ver_iter = i.second->metadata.find("ceph_version"); + if (ver_iter != i.second->metadata.end()) { + ceph_version = i.second->metadata.at("ceph_version"); + } f->open_object_section("service"); f->dump_string("type", str_type);