When the -p parameter is given without an argument, the password is read
from the command line. This allows passwords to be given to MaxCtrl in a
safer manner.
When TSV output is requested, the output should not contain the ANSI color
codes. This appears to be a "feature" of the table generation library but
it is quite simple to work around.
When the servers were iterated, each related monitor was requested. This
caused as many requests for monitors as there are servers.
By creating a set of unique monitor names and requesting them once, we
avoid the redundant requests from the monitor.
The function getResource had two different implementations that did very
different things. The newer version, that returns the raw JSON object that
represents a resource, was renamed to getJson.
Added the `GTID` field to make it easier to track GTID values of the
servers. This is done by requesting the related monitors for each server
and injecting an extra parameter into the server resource.
MaxCtrl now supports explicit paths for certificates and optional server
certificate verification. This allows testing by using a self-signed
certificate with the server certificate verification turned off.
Using commas instead of spaces prevents a the misinterpretation of
commands as hostnames. If the `--hosts` option was given just before a
command, it would consume the commands as arguments to the `--hosts` list.
The yargs framework combined with the pkg packaging causes the executable
name to be mangled on installation. For this reason, the usage should be
explicitly added to each command.
The timestamp of the last change from passive to active is now
tracked. This, with the timestamps of the last master_down and master_up
events, allows detection of cases when MaxScale was failed over but the
failover was not done.
Currently, only a warning is logged if no new master has appeared within
90 seconds of a master_down event and MaxScale was set to active from
passive.
The last event and when the event was triggered is now shown for all
servers. The latest change from passive to active is also shown.
The documentation stated that the users are created with administrative
privileges by default when in fact they were created with read-only
privileges.
The type of the created user can now be specified with the --type option.
Expanded tests that cover the user creation. Also added a test case that
checks that basic users are only allowed to read through the REST API.
The check that the two MaxScales have the same services is now in a common
function. Added more details into the error message as to why the command
failed. The hosts and their extra services are logged for both the source
and target of the command.
The `cluster diff` command could display the extra services in the diff
but this could be interpreted as a sign that MaxScale could act on that
part of the diff. Returning an error instead of silently ignoring the
extra services should allow for a more consistent user experience.
The `execute` command now returns the output of the command instead of
printint it. This allows the tests to actually test the output of the
commands instead manually verifying that it is correct. It also allows the
library part to be used as an actual library that only returns data.
The messages now show where the request failed and what was
requested. This should help resolve both develper and end-user problems.
Also fixed the missing logging of the output string in the `parse`
callback of the main function and cleaned up the POSTed server body.
The monitors should only be reused if they have the same name and they use
the same module. This way the only difference is in configuration.
Fixed MaxCtrl detection of bad options and altered monitor creation test
to expect correct results. Also improved some of the error messages.
The test tests the internals of the cluster diff generation
algorithms. This should guarantee that the diff calculation and the
resulting synchronization will work as expected without having to test it
on a live cluster.
The `cluster sync` command synchronizes a MaxScale cluster with one
server. This allows new MaxScale instances to be synchronized with an old
instance by using the same configuration file and performing a cluster
sync.
The `cluster diff` command prints out the difference between the source
and target MaxScale. This allows users to detect changes that have
happened on one MaxScale but not on the other.
All errors are now returned as rejected Promises. This will make the error
reporting more consistent with the tested output as well as the actual
output.
Added more tests for error cases and fixed minor argument processing bugs.
The alterations to logging and maxscale were sending malformed JSON to
MaxScale. Boolean values weren't converted to JSON booleans but were sent
as strings.
Making the core a module proved to bring more problems than it solved. For
the sake of simplicity in installation and code coverage reporting, the
core is now completely contained in the `lib/` directory.
Also added preliminary coverage reporting with nyc.
Minor refactoring to the core library to allow multiple calls from within
the same program.
Added --quiet option to silence output so that tests aren't so
verbose. Currently this only works on UNIX based systems.
The request-promise-native package adds support for request with native
promises. This is a convenient way to synchronize multiple HTTP requests.
The functions are changed to use promises to make testing easier. With
promises, the testing code can use the chai-as-promised library.
There are a few cases where doRequest is called with a callback that again
calls doAsyncRequest. With multiple hosts, this causes each command to be
propagated to all servers. This is a design flaw of the current multi-host
mode and needs to be changed.
Changed maxctrl.js to wait on the promises to silence some warnings if the
promise rejections are ignored.
All invocations into the common helper functions are now done through the
`maxctrl` function. This allows the program arguments to be passed to the
core as a parameter instead of reading them from global variables.
This helps with the implicit initialization that was done when the yargs
library was required which caused duplicated output.
Refactored the core functions so that they only process the argument
vector. The parsing of the argument vector is done in maxctrl.js where it
is more appropriate.