]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: fix crash on missing 'ceph_version' in daemon metadata
authorTim Serong <tserong@suse.com>
Fri, 24 Mar 2017 15:38:19 +0000 (16:38 +0100)
committerTim Serong <tserong@suse.com>
Fri, 24 Mar 2017 15:40:26 +0000 (16:40 +0100)
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 <tserong@suse.com>
src/mgr/PyModules.cc

index a4ddcda38c199e5b4a47eeed4c24f3e8f513d363..72eda5e58cde4f36fd98b08e71bc0e8869b5a054 100644 (file)
@@ -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);