]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-objectstore-tool: Handle object names that are also valid json 12848/head
authorDavid Zafman <dzafman@redhat.com>
Tue, 10 Jan 2017 01:34:12 +0000 (17:34 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 10 Jan 2017 01:34:12 +0000 (17:34 -0800)
Treat an argument that happens to be json but doesn't conform to our requirements
as an object name.

Signed-off-by: David Zafman <dzafman@redhat.com>
src/tools/ceph_objectstore_tool.cc

index ec869fc5d43945b288e241c14b3aef08f379086c..d7d1319f6c35bc915d0eb820f3f7b91ba73cfe9f 100644 (file)
@@ -2666,7 +2666,8 @@ int main(int argc, char **argv)
     } else {
     json_spirit::Value v;
     try {
-      if (!json_spirit::read(object, v)) {
+      if (!json_spirit::read(object, v) ||
+          (v.type() != json_spirit::array_type && v.type() != json_spirit::obj_type)) {
         // Special: Need head/snapdir so set even if user didn't specify
         if (vm.count("objcmd") && (objcmd == "remove-clone-metadata"))
          head = true;