109 Commits

Author SHA1 Message Date
Johan Wikman
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
Johan Wikman
5cf56c7c0f Merge branch '2.1' into 2.2 2018-04-24 12:39:22 +03:00
Johan Wikman
bafe8f5eeb MXS-1618 Use right type for the return value of getopt_long
getopt_long returns an 'int'. If 'char' is used on a big-endian
platform you'll end up with an infinite loop.
2018-04-24 12:31:08 +03:00
Markus Mäkelä
0366736759
MXS-1683: Use non-interactive mode when terminal setup fails
When the terminal configuration fails, it usually means that no terminal
is attached to the controlling process. This is the case when scripts are
executed automatically by daemon processes. To allow maxadmin use without
a controlling terminal, the editline library functionality must not be
used when the terminal setup fails.

To facilitate this fix, a minor refactoring of the code was done to split
the parts that use editline into separate functions. This allows simple
and easy fallback to non-editline code in the case that editline is
available but the terminal is not interactive.
2018-03-06 13:35:15 +02:00
Markus Mäkelä
73de112ae4
MXS-1683: Allow MaxAdmin use without controlling tty
When MaxAdmin would be used without a controlling terminal, it would
refuse to accept passwords from stdin as it could not set the terminal
attributes. This means that executing MaxAdmin commands from other
programs would fail if the process had no controlling terminal.

Turning the error into a warning will allow users to know that terminal
echo is still enabled before they type their passwords.
2018-03-06 13:35:14 +02:00
Markus Mäkelä
68bcd00a22 Merge branch '2.1' into develop 2017-09-20 10:47:53 +03:00
Markus Mäkelä
d003983e5a MXS-1409: Improve MaxAdmin error messages
If both socket and network options are listed, a clear error message is
printed. The usage is also split into two lines to make it clear that the
options should be used separately.
2017-09-16 07:44:25 +03:00
Markus Mäkelä
854c4a1ed3 Add support for non-glibc systems
MaxScale can now be built on systems that use an alternative libc
implementation e.g. musl.
2017-08-02 11:51:55 +03:00
Markus Mäkelä
d59d3ab638 MXS-1300: Combine REST API and MaxCtrl tests
The REST API tests are now located under the maxctrl directory. This
allows both tests to use the same framework for testing.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
f83d793704 MXS-1300: Split the code into core and cli parts
The cli part of the code just passes the process argument vector the the
core part. The core part contains the actual functional parts of the
code. This split is done to make testing easier.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
2670ca36a0 MXS-1300: Send requests to multiple hosts
The host and port options were replace with one hosts option which
combines the two. This allows a single command to be executed on multiple
maxscale instances. Added accompanying code for checking responsiveness of
all maxscale instances and handling synchronization of the check
results. The code uses ECMAScript 2016 native promises to do this.

Added a configurable timeout to all requests. This should allow users to
interact with MaxScale over slow and laggy networks.

Before each executed command, all hosts given as parameters are pinged to
make sure they are alive. This should reduce the possibility of partial
execution of commands due to failed MaxScales.

The results of requests are grouped by the values of the hosts
option. This allows users to compare results of multiple servers with
relative ease.

Fixed reversion of the default credentials from mariadb:admin to
admin:mariadb.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
11c8493167 MXS-1300: Only use single quotes
Fixed mixed use of single and double quotes.
2017-07-18 11:37:18 +03:00
Markus Mäkelä
a77406e134 MXS-1300: Add calling of module commands to MaxCtrl
Module commands can now be called with MaxCtrl.
2017-07-10 22:23:49 +03:00
Markus Mäkelä
e14aa729ab MXS-1300: Add module commands to MaxCtrl
Added inspection of module commands to MaxCtrl. The commands can't be
called yet.
2017-07-10 22:23:49 +03:00
Markus Mäkelä
1514ede4e1 MXS-1300: Add logging commands
Added commands for altering logging parameters and for rotating logs.
2017-07-10 22:23:48 +03:00
Markus Mäkelä
78a95def7d MXS-1300: Add build script for MaxCtrl
The build uses the pkg library to package a Node.js app and all of its
dependenices.
2017-07-10 22:23:48 +03:00
Markus Mäkelä
ebfa631bae MXS-1330: Add alter command
Servers, monitors and services can now be altered with MaxCtrl.
2017-07-10 22:23:48 +03:00
Markus Mäkelä
4913cf1ec7 MXS-1300: Add maxscale to show commands
The command shows general information about MaxScale.
2017-07-10 22:23:48 +03:00
Markus Mäkelä
f4dacff27c MXS-1300: Correct clear entry point documentation
Corrected the clear entry point documentation by changing the method from
POST to PUT. Fixed MaxCtrl to use the correct methods for set/clear.
2017-07-10 22:23:48 +03:00
Markus Mäkelä
252022534c MXS-1300: Add start/stop commands
Added start and stop commands for starting and stopping services and
monitors.
2017-07-10 22:23:48 +03:00
Markus Mäkelä
a0e7a97729 MXS-1300: Add create/destroy/list commands for users
Users can now be listed, created and destroyed via MaxCtrl.
2017-07-10 22:23:48 +03:00
Markus Mäkelä
b0f2d02787 MXS-1300: Add link/unlink command to MaxCtrl
The link/unlink commands are similar to the add/remove commands in
MaxAdmin but they link services and monitors to a list of servers instead
of linking servers to a list of either services or monitors. This can
reduce the number of required calls to alter the configuration while
making the process easier for MaxCtrl to do via the REST API.

Also fixed a false negative where a service alteration which results in a
no-op would be counted as an error.
2017-07-10 22:23:47 +03:00
Markus Mäkelä
7db1f4c768 MXS-1300: Add create/destroy commands
Servers, monitors and listeners can now be created and destroyed with
MaxCtrl.

Exported lodash as a part of the common.js module so that commands can use
it to construct objects. If there are enough common uses of this library,
some of the object construction could be moved to the common module.
2017-07-10 22:23:46 +03:00
Markus Mäkelä
bb5b83bf7b MXS-1300: Add enable/disable command
The enable/disable commands allow logging options and UNIX admin accounts
to be enabled and disabled.
2017-07-10 22:23:45 +03:00
Markus Mäkelä
cfa0fd9803 MXS-1300: Create more helper functions
The common error logging function prints and colors the output in an
uniform way. The updateValue function allows easy PATCH updates to a
single value of a resource.
2017-07-10 22:23:45 +03:00
Markus Mäkelä
c7b9b7ac4a MXS-1220: Unify resource member naming
All resoures now use the `state` member to describe their internal
state. This includes servers, services and monitors. This means that the
`status` keyword can be reserved for something else and it can be removed
until it is needed again.

Changed the module maturity field to `maturity` to better describe its
purpose.
2017-07-10 22:23:45 +03:00
Markus Mäkelä
30a40a090b MXS-1300: Make global option descriptions more brief
The option descriptions now fit on one line with their parameter types and
default values.
2017-07-10 22:23:44 +03:00
Markus Mäkelä
6955be901f MXS-1300: Use single quotes in Node.js code
The Node.js code should use single quotes as it appears to be a prevalent
style choice for Node.js applications.
2017-07-10 22:23:44 +03:00
Markus Mäkelä
8fb1137ef0 MXS-1300: Add usage to all commands
Added usage instructions for all commands. If the generated usage is used
with the `pkg` packager, it will contain generated script names which are
confusing.
2017-07-10 22:23:44 +03:00
Markus Mäkelä
4cf17bc450 MXS-1300: Add set and clear commands
The manipulation of server status is now possible with the set and clear
commands.
2017-07-10 22:23:44 +03:00
Markus Mäkelä
38930e198d MXS-1300: Fix duplicated options
Moved the option declaration to the main source file. Added default
functions for all modules to catch unknown command invokations. Cleaned up
and exposed more ways to use the doRequest function.
2017-07-10 22:23:44 +03:00
Markus Mäkelä
c189378389 MXS-1330: Pair header names with resource paths
The getCollection and getResource now use similar mechanisms to declare
the names and values for the tables.
2017-07-10 22:23:44 +03:00
Markus Mäkelä
1148ed9876 MXS-1300: Add initial implementation of MaxCtrl
This is the administrative client that uses the REST API to communicate
with MaxScale. It is written in Node.js as it can handle the JSON format
data returned by the REST API natively. Currently only list and show
functionality is implemented.
2017-07-10 22:23:43 +03:00
Markus Mäkelä
457fc80647 Merge branch '2.1' into develop 2017-06-05 13:25:27 +03:00
Markus Mäkelä
684e2e153f MXS-1277: Improve maxadmin error messages
Maxadmin now reports if the default socket was found and suggests actions
to take.
2017-06-05 13:17:15 +03:00
Johan Wikman
f546a17e77 Update change date of 2.2 2017-06-01 10:24:20 +03:00
Esa Korhonen
b41074c92b Disable MaxAdmin automatic file reading
Previously, MaxAdmin would interpret any non-option words in the
command line as either a filename or, if the file could not be opened,
as MaxAdmin commands. This made it possible to mix filenames and
commands if there was a matching filename in the folder. For example
"maxadmin show services" would read commands from a file named
"show services" if it existed. This update removes this feature. To
read commands from a file, use either shell redirection "maxadmin <
mycommands" or the "source"-command inside maxadmin.
2017-03-30 14:33:34 +03:00
Johan Wikman
49cc2b52e3 Merge branch '2.1.0' into 2.1 2017-02-15 08:44:55 +02:00
Johan Wikman
5648f708af Update license to BSL 1.1 2017-02-14 21:42:28 +02:00
Markus Mäkelä
acd66b4eb3 Fix compiler warnings
Added missing checks for return values of various function calls. Fixed
binlogrouter strerror_r usage and wrong buffer sizes.
2017-02-13 11:44:38 +02:00
Markus Mäkelä
3205092540 Format miscellaneous files
Formatted client, avro and rabbitmq consumer files with Astyle.
2017-01-17 14:48:43 +02:00
ekorh475
38af20569c MaxAdmin defaults to Emacs-mode and other small changes
1. MaxAdmin now defaults to Emacs-mode. To activate Vim-mode, give
the option 'i' when starting.
2. "history" and "source"-commands are parsed correctly.
3. Added a check to DoSource() so that empty commands are not sent.
MaxScale doesn't respond to empty commands which would cause MaxAdmin
to wait forever.
2016-12-12 17:34:35 +02:00
Markus Makela
3ba8525063 Remove old .gitignore files
The files were used to deal with old Makefile builds.
2016-11-28 14:37:26 +02:00
ekorh475
d7c476314e Have maxadmin ask for password if none was given with -p
MXS-399 If maxadmin was started with -p and no password was given,
it printed a help message. Now it asks for password as if no -p was
given.
2016-11-11 15:05:36 +02:00
Markus Makela
084aacb11c Fix debugcmd parameter processing
The debugcmd parameter processing didn't actually allow the maximum number
of parameters to be passed to the function. The detailed help text was
never printed and most of them were only duplicates of the short
description.
2016-11-10 15:15:10 +02:00
Markus Makela
ab9f8ebfac Fix non-libedit builds of maxadmin
A variable was not declared if libedit-devel wasn't installed.
2016-10-22 05:06:42 +03:00
Johan Wikman
5cc436c37c MXS-955: Put back proper .maxadmin handling
Now MaxScale again supports having 'hostname', 'user', 'port' and 'passwd'
in the .maxadmin file in addition to 'socket'.
2016-10-21 13:53:17 +03:00
Johan Wikman
c433d11b39 Module private headers moved to modules 2016-10-13 22:59:39 +03:00
Johan Wikman
e41589be10 Move headers from server/include to include/maxscale
- Headers now to be included as <maxscale/xyz.h>
- First step, no cleanup of headers has been made. Only moving
  from one place to another + necessary modifications.
2016-10-13 16:19:20 +03:00
Johan Wikman
d7f79942be Merge branch '2.0' into develop 2016-09-09 15:12:58 +03:00