]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph_json: parser sets data on all types when parsing
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 19 Dec 2018 11:15:30 +0000 (03:15 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 19 Dec 2018 11:36:49 +0000 (03:36 -0800)
Fixes: http://tracker.ceph.com/issues/37706
This was changed in e47a228a868, but breaks existing usage.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/common/ceph_json.cc

index cc12a620211c20740529624032c8e00e4334685c..c1b77c0ebce668ee3ccbd26406001e069b4d77d4 100644 (file)
@@ -170,13 +170,10 @@ void JSONObj::init(JSONObj *p, Value v, string n)
   data = v;
 
   handle_value(v);
-  if (v.type() != obj_type &&
-      v.type() != array_type) {
-    if (v.type() == str_type) {
-      val.set(v.get_str(), true);
-    } else {
-      val.set(json_spirit::write_string(v), false);
-    }
+  if (v.type() == str_type) {
+    val.set(v.get_str(), true);
+  } else {
+    val.set(json_spirit::write_string(v), false);
   }
   attr_map.insert(pair<string,data_val>(name, val));
 }