64 Commits

Author SHA1 Message Date
Johan Wikman
c48c4c7950 Use the effective name when looking for a module
Using the effective name means that a module command can be invoked
both using the deprecated name as well as the actual name. E.g.
both using mysqlmon and mariadbmon even though only the last one
actually exists as a module.
2017-12-29 08:34:46 +02:00
Markus Mäkelä
396b81f336 Fix in-source builds
The internal header directory conflicted with in-source builds causing a
build failure. This is fixed by renaming the internal header directory to
something other than maxscale.

The renaming pointed out a few problems in a couple of source files that
appeared to include internal headers when the headers were in fact public
headers.

Fixed maxctrl in-source builds by making the copying of the sources
optional.
2017-11-22 18:40:18 +02:00
Johan Wikman
4aea1b6150 Always return json object from module commands
If a module command returns a json object, it will always be
returned to the caller, irrespective of whether the command
itself succeeded or not.

Otherwise, if the command failed and if the module command has
set an error message, that error message will be returned as a
json object containing the error message.
2017-09-29 13:10:29 +03:00
Markus Mäkelä
14d8b6a0df Remove MODULECMD_ARG_OUTPUT argument type
Since the module command interface was expanded to include a JSON output
parameter, there is no longer a need for an output DCB. As the JSON can be
printed by both maxadmin and the REST API, this allows the removal of
explicit output formatting in module commands.
2017-09-28 13:59:28 +03:00
Markus Mäkelä
730072e2ef Add format checks for printf-style functions
Added format checks to functions that expect printf style arguments and
fixed any broken calls to these functions.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
9847b36a12 Fix invalid module command argument count
The module commands were always given the maximum argument count even if
less arguments were given.
2017-08-09 11:39:25 +03:00
Markus Mäkelä
53d7c57982 MXS-1220: Add error descriptions to REST API module commands
The module command calls that fail can now display additional information
in the form of an error object.
2017-06-12 10:08:25 +03:00
Markus Mäkelä
45afbda100 Add descriptions to module commands
Each module command has to describe what it does. This should make module
commands self-documenting to some degree.
2017-06-12 10:08:25 +03:00
Markus Mäkelä
b3c1e15f22 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.
2017-06-12 10:08:25 +03:00
Markus Mäkelä
ba546fcd21 MXS-1220: Add execution of module commands to REST API
The module command self links now point to an endpoint that executes the
module command. Depending on the type of the module command, either a GET
or a POST request must be made.
2017-06-02 12:52:33 +03:00
Johan Wikman
f546a17e77 Update change date of 2.2 2017-06-01 10:24:20 +03:00
Markus Mäkelä
7baa52b763 Make modulecmd_argtype_to_str return values constant
The function needlessly allocated memory for the type strings.
2017-05-29 19:27:45 +03:00
Esa Korhonen
bfd94c2b31 KILL [CONNECTION | QUERY] support, part1
Preparation for adding KILL syntax support.
Session id changed to uint32 everywhere. Added atomic op.
Session id can be acquired before session_alloc().
Added session_alloc_with_id(), which is given a session id number.
Worker object has a session_id->SESSION* mapping, not used yet.
2017-05-02 10:29:55 +03:00
Johan Wikman
3755a5a7b0 Compile modulecmd.c as C++ 2017-03-24 11:19:01 +02:00