MXS-1220: Add output for module commands

The module commands can now produce JSON formatted output which is passed
to the caller. The output should conform to the JSON API as closely as
possible.

Currently, the REST API wraps all JSON produced by module commands inside
a meta-object of the following type:

  {
    "meta": <output of module command>
  }

This allows the output to be JSON API conformant without modifying the
modules and allows incremental updates to code.
This commit is contained in:
Markus Mäkelä
2017-06-09 10:13:41 +03:00
parent 66a45fc37e
commit b3c1e15f22
14 changed files with 119 additions and 40 deletions

View File

@ -1717,7 +1717,8 @@ static void callModuleCommand(DCB *dcb, char *domain, char *id, char *v3,
if (arg)
{
if (!modulecmd_call_command(cmd, arg))
// TODO: Print output instead of passing a writable DCB to the command
if (!modulecmd_call_command(cmd, arg, NULL))
{
dcb_printf(dcb, "Error: %s\n", modulecmd_get_error());
}