The documentation stated that the users are created with administrative
privileges by default when in fact they were created with read-only
privileges.
Updated documentation generation script and regenerated documentation. Now
all command documentation is generated by using the output of the `help`
commands.
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.
Only the protocol, port and address of the listener were used to check if
a listener exists. The check should also use the name of the listener to
be sure that each name is unique.
Expanded tests to check that the creation of duplicate listeners is
detected. Did minor improvements to related test code.
The `cluster diff` command is now tested by doing add/alter/remove
operations on servers. As the same methods are used for all objects, they
should detect all sorts of modifications between two Maxscales.
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.
Moved MaxCtrl into a separate package to simplify packaging and
distribution process. Having the client as a separate component allows one
set of packages to be used on multiple platforms.
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 tests are now sorted by command type. This allows for more consistent
test creation as tests can be done per source code file instead of per
object type.
Added helper functions for common testing operations. The two main ones
are doCommand, which executes a MaxCtrl command and returns a result, and
verifyCommand, that executes a command and verifies the result via the
REST API.
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.
The monitor user and password can now be defined as options to the create
command. This should help with the creation of a monitor in one request.
Fixed the command description of `create listener`.
If an unexpected network error occurs, only the error part of the response
should be printed. The complete object should be dumped only as a last
resort.
The main `maxctrl` function now does the cluster health checks and handles
the iteration over the host list. This solves the problem of how to
execute commands on multiple hosts while still allowing recursive calls
into the common functions.
This does not, however, solve the problem of how interconnected commands
across a set of servers are handled. One way to solve this would be to
offer a second main function, `maxctrl_cluster` which would call the
callback with a set of servers instead of a single server.
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.