Merge branch '2.3' into develop
This commit is contained in:
@ -135,6 +135,28 @@ exports.builder = function(yargs) {
|
||||
return updateValue(host, 'maxscale', 'data.attributes.parameters.' + argv.key, argv.value)
|
||||
})
|
||||
})
|
||||
.command('user <name> <password>', 'Alter admin user passwords', function(yargs) {
|
||||
return yargs.epilog('Changes the password for a user. To change the user type, destroy the user and then create it again.')
|
||||
.usage('Usage: alter user <name> <password>')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
|
||||
var user = {
|
||||
'data': {
|
||||
'id': argv.name,
|
||||
'type': 'inet',
|
||||
'attributes': {
|
||||
'password': argv.password
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getJson(host, 'users/inet/' + argv.name)
|
||||
.then((res) => user.data.attributes.account = res.data.attributes.account)
|
||||
.then(() => doRequest(host, 'users/inet/' + argv.name, null, {method: 'DELETE'}))
|
||||
.then(() => doRequest(host, 'users/inet', null, {method: 'POST', body: user}))
|
||||
})
|
||||
})
|
||||
.usage('Usage: alter <command>')
|
||||
.help()
|
||||
.command('*', 'the default command', {}, function(argv) {
|
||||
|
||||
@ -166,12 +166,10 @@ exports.builder = function(yargs) {
|
||||
}
|
||||
}
|
||||
|
||||
if (argv.params) {
|
||||
var err = validateParams(argv, argv.params)
|
||||
if (err) {
|
||||
return Promise.reject(err)
|
||||
}
|
||||
var err = false;
|
||||
|
||||
if (argv.params) {
|
||||
err = validateParams(argv, argv.params)
|
||||
monitor.data.attributes.parameters = argv.params.reduce(to_obj, {})
|
||||
}
|
||||
|
||||
@ -189,6 +187,9 @@ exports.builder = function(yargs) {
|
||||
}
|
||||
|
||||
maxctrl(argv, function(host) {
|
||||
if (err) {
|
||||
return Promise.reject(err)
|
||||
}
|
||||
return doRequest(host, 'monitors', null, {method: 'POST', body: monitor})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user