*/
#include "DaemonServer.h"
+#include <boost/algorithm/string.hpp>
#include "mgr/Mgr.h"
#include "include/stringify.h"
session->inst.name = m->get_source();
}
- std::string format;
- boost::scoped_ptr<Formatter> f;
map<string,string> param_str_map;
std::stringstream ss;
int r = 0;
return true;
}
- {
- cmd_getval(cmdctx->cmdmap, "format", format, string("plain"));
- f.reset(Formatter::create(format));
- }
-
string prefix;
cmd_getval(cmdctx->cmdmap, "prefix", prefix);
+ dout(10) << "decoded-size=" << cmdctx->cmdmap.size() << " prefix=" << prefix << dendl;
- dout(10) << "decoded-size=" << cmdctx->cmdmap.size() << " prefix=" << prefix << dendl;
+ boost::scoped_ptr<Formatter> f;
+ {
+ std::string format;
+ if (boost::algorithm::ends_with(prefix, "_json")) {
+ format = "json";
+ } else {
+ cmd_getval(cmdctx->cmdmap, "format", format, string("plain"));
+ }
+ f.reset(Formatter::create(format));
+ }
// this is just for mgr commands - admin socket commands will fall
// through and use the admin socket version of
if (prefix == "pg dump_json") {
vector<string> v;
v.push_back(string("all"));
- cmd_putval(g_ceph_context, cmdmap, "format", string("json"));
cmd_putval(g_ceph_context, cmdmap, "dumpcontents", v);
prefix = "pg dump";
} else if (prefix == "pg dump_pools_json") {
vector<string> v;
v.push_back(string("pools"));
- cmd_putval(g_ceph_context, cmdmap, "format", string("json"));
cmd_putval(g_ceph_context, cmdmap, "dumpcontents", v);
prefix = "pg dump";
} else if (prefix == "pg ls-by-primary") {