MXS-1300: Add monitor credentials as create options

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`.
This commit is contained in:
Markus Mäkelä
2017-07-18 22:01:07 +03:00
parent fa6bea33fe
commit 0f8cd4e90c

View File

@ -82,7 +82,15 @@ exports.builder = function(yargs) {
describe: 'Link the created monitor to these servers',
type: 'array'
})
.command('monitor <name> <module>', 'Create a new server', {}, function(argv) {
.option('monitor-user', {
describe: 'Username for the monitor user',
type: 'string'
})
.option('monitor-password', {
describe: 'Password for the monitor user',
type: 'string'
})
.command('monitor <name> <module>', 'Create a new monitor', {}, function(argv) {
var monitor = {
'data': {
@ -99,6 +107,13 @@ exports.builder = function(yargs) {
}
}
if (argv.monitorUser) {
_.set(monitor, 'data.attributes.parameters.user', argv.monitorUser)
}
if (argv.monitorPassword) {
_.set(monitor, 'data.attributes.parameters.password', argv.monitorPassword)
}
maxctrl(argv, function(host) {
return doRequest(host, 'monitors', null, {method: 'POST', body: monitor})
})
@ -132,7 +147,7 @@ exports.builder = function(yargs) {
describe: 'TLS certificate verification depth',
type: 'string'
})
.command('listener <service> <name> <port>', 'Create a new server', {}, function(argv) {
.command('listener <service> <name> <port>', 'Create a new listener', {}, function(argv) {
var listener = {
'data': {