int ActivePyModule::handle_command(
const cmdmap_t &cmdmap,
+ const bufferlist &inbuf,
std::stringstream *ds,
std::stringstream *ss)
{
PyFormatter f;
cmdmap_dump(cmdmap, &f);
PyObject *py_cmd = f.get();
+ string instr;
+ inbuf.copy(0, inbuf.length(), instr);
auto pResult = PyObject_CallMethod(pClassInstance,
- const_cast<char*>("handle_command"), const_cast<char*>("(O)"), py_cmd);
+ const_cast<char*>("handle_command"), const_cast<char*>("s#O"),
+ instr.c_str(), instr.length(), py_cmd);
Py_DECREF(py_cmd);
int handle_command(
const cmdmap_t &cmdmap,
+ const bufferlist &inbuf,
std::stringstream *ds,
std::stringstream *ss);
int ActivePyModules::handle_command(
std::string const &module_name,
const cmdmap_t &cmdmap,
+ const bufferlist &inbuf,
std::stringstream *ds,
std::stringstream *ss)
{
}
lock.Unlock();
- return mod_iter->second->handle_command(cmdmap, ds, ss);
+ return mod_iter->second->handle_command(cmdmap, inbuf, ds, ss);
}
void ActivePyModules::get_health_checks(health_check_map_t *checks)
int handle_command(
const std::string &module_name,
const cmdmap_t &cmdmap,
+ const bufferlist &inbuf,
std::stringstream *ds,
std::stringstream *ss);
}
std::stringstream ds;
- int r = py_modules.handle_command(handler_name, cmdctx->cmdmap, &ds, &ss);
+ bufferlist inbl = cmdctx->m->get_data();
+ int r = py_modules.handle_command(handler_name, cmdctx->cmdmap, inbl, &ds, &ss);
cmdctx->odata.append(ds);
cmdctx->reply(r, ss);
}));
int PyModuleRegistry::handle_command(
std::string const &module_name,
const cmdmap_t &cmdmap,
+ const bufferlist &inbuf,
std::stringstream *ds,
std::stringstream *ss)
{
if (active_modules) {
- return active_modules->handle_command(module_name, cmdmap, ds, ss);
+ return active_modules->handle_command(module_name, cmdmap, inbuf, ds, ss);
} else {
// We do not expect to be called before active modules is up, but
// it's straightfoward to handle this case so let's do it.
int handle_command(
std::string const &module_name,
const cmdmap_t &cmdmap,
+ const bufferlist &inbuf,
std::stringstream *ds,
std::stringstream *ss);
super(Module, self).__init__(*args, **kwargs)
self.event = Event()
- def handle_command(self, command):
+ def handle_command(self, inbuf, command):
self.log.warn("Handling command: '%s'" % str(command))
if command['prefix'] == 'balancer status':
s = {
logger.info('Stopping engine...')
self.shutdown_event.set()
- def handle_command(self, cmd):
+ def handle_command(self, inbuf, cmd):
res = handle_option_command(cmd)
if res[0] != -errno.ENOSYS:
return res
},
]
- def handle_command(self, cmd):
+ def handle_command(self, inbuf, cmd):
self.log.info("hello_world_info")
self.log.debug("hello_world_debug")
self.log.error("hello_world_error")
self.run = False
self.event.set()
- def handle_command(self, cmd):
+ def handle_command(self, inbuf, cmd):
if cmd['prefix'] == 'influx config-show':
return 0, json.dumps(self.config), ''
elif cmd['prefix'] == 'influx config-set':
super(Module, self).__init__(*args, **kwargs)
- def handle_command(self, command):
+ def handle_command(self, inbuf, command):
rd = 0
wr = 0
total = 0
"""
self._ceph_set_health_checks(checks)
- def handle_command(self, cmd):
+ def handle_command(self, inbuf, cmd):
"""
Called by ceph-mgr to request the plugin to handle one
of the commands that it declared in self.COMMANDS
output string. The output buffer is for data results,
the output string is for informative text.
+ :param string inbuf: content of any "-i <file>" supplied to ceph cli
:param dict cmd: from Ceph's cmdmap_t
:return: 3-tuple of (int, str, str)
]
return 0, json.dumps(ret), ""
- def handle_command(self, cmd):
+ def handle_command(self, inbuf, cmd):
if cmd['prefix'] == 'prometheus self-test':
self.collect()
self.get_file_sd_config()
)
- def handle_command(self, command):
+ def handle_command(self, inbuf, command):
self.log.warn("Handling command: '%s'" % str(command))
if command['prefix'] == "restful create-key":
if command['key_name'] in self.keys:
self._event = threading.Event()
self._workload = None
- def handle_command(self, command):
+ def handle_command(self, inbuf, command):
if command['prefix'] == 'mgr self-test run':
self._self_test()
return 0, '', 'Self-test succeeded'
},
]
- def handle_command(self, cmd):
+ def handle_command(self, inbuf, cmd):
self.log.error("handle_command")
if cmd['prefix'] == 'osd smart get':
return 0, osd_table.get_string(), ""
- def handle_command(self, cmd):
+ def handle_command(self, inbuf, cmd):
self.log.error("handle_command")
if cmd['prefix'] == "fs status":
self.run = False
self.event.set()
- def handle_command(self, cmd):
+ def handle_command(self, inbuf, cmd):
if cmd['prefix'] == 'telegraf config-show':
return 0, json.dumps(self.config), ''
elif cmd['prefix'] == 'telegraf config-set':
requests.put(url=self.config['url'], json=report, proxies=proxies)
- def handle_command(self, command):
+ def handle_command(self, inbuf, command):
if command['prefix'] == 'telemetry config-show':
return 0, json.dumps(self.config), ''
elif command['prefix'] == 'telemetry config-set':
return False
- def handle_command(self, command):
+ def handle_command(self, inbuf, command):
if command['prefix'] == 'zabbix config-show':
return 0, json.dumps(self.config), ''
elif command['prefix'] == 'zabbix config-set':