]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
mgr: check for unicode passed to "set_health_checks()"
authorKefu Chai <kchai@redhat.com>
Thu, 18 Jul 2019 17:29:52 +0000 (01:29 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 25 Jul 2019 01:00:28 +0000 (09:00 +0800)
commit34099370037e5ab9f03576e93af364dfd65f1519
treec6702d4fc6821c51cf23462227111f4d163f2e9d
parent0c0093e4503f09b3f7ce29f834251523f182bd18
mgr: check for unicode passed to "set_health_checks()"

in python2, in addition to `str`, a string could also be unicode
string. there is chance that user passes a unicode string to
`set_health_checks()`, so let's check for unicode string also.

in python3, all strings are `unicode` string, and `PyString_Check()` is
defined as an alias of `PyUnicode_Check()`, so we are fine with python3.

the wrapper method of `PyString_ToString()` returns a pair of converted
string and a bool. if it fails to detect a string, an empty string and
false are returned.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mgr/BaseMgrModule.cc
src/mgr/PythonCompat.h