]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/restful: jsonify lists instead of maps 32421/head
authorKefu Chai <kchai@redhat.com>
Wed, 25 Dec 2019 07:26:39 +0000 (15:26 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 25 Dec 2019 07:30:36 +0000 (15:30 +0800)
commitccd95ef97be1c6bbd332d0d0943279db12b73b0c
tree5726674489d6ef67d72bbba618757d74b1c3bf50
parent39700358df7c2f245cba41cf20f870a83b3fd249
mgr/restful: jsonify lists instead of maps

in python3, `map()` returns a `map` instance which is iterable, while in
python2, `map()` returns a `list`, but `JSONEncoder.default()` expects a
list or whatever which inherits from `json.JSONEncoder`.

in this change, we just return a materized list instead of a map for
json encoder.

Fixes: https://tracker.ceph.com/issues/43416
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/restful/module.py