From: Sage Weil Date: Wed, 17 Jul 2019 16:48:50 +0000 (-0500) Subject: mgr/BaseMgrModule: handle unicode health detail strings X-Git-Tag: v14.2.5~61^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=40562f31f00552a5e40999c54c8a7be86b461697;p=ceph.git mgr/BaseMgrModule: handle unicode health detail strings Signed-off-by: Sage Weil (cherry picked from commit 52875c6cb2c615d1070a456d0e1dcc708d5fd5db) --- diff --git a/src/mgr/BaseMgrModule.cc b/src/mgr/BaseMgrModule.cc index 59bbe8f393ed..7415db0ba4c4 100644 --- a/src/mgr/BaseMgrModule.cc +++ b/src/mgr/BaseMgrModule.cc @@ -296,9 +296,9 @@ ceph_set_health_checks(BaseMgrModule *self, PyObject *args) severity = HEALTH_ERR; } } else if (ks == "summary") { - if (!PyString_Check(v)) { + if (!PyString_Check(v) && !PyUnicode_Check(v)) { derr << __func__ << " check " << check_name - << " summary value not string" << dendl; + << " summary value not [unicode] string" << dendl; continue; } summary = PyString_AsString(v); @@ -310,9 +310,9 @@ ceph_set_health_checks(BaseMgrModule *self, PyObject *args) } for (int k = 0; k < PyList_Size(v); ++k) { PyObject *di = PyList_GET_ITEM(v, k); - if (!PyString_Check(di)) { + if (!PyString_Check(di) && !PyUnicode_Check(di)) { derr << __func__ << " check " << check_name - << " detail item " << k << " not a string" << dendl; + << " detail item " << k << " not a [unicode] string" << dendl; continue; } detail.push_back(PyString_AsString(di));