MXS-1300: Take the refactored core into use

The refactored maxctrl function is now in use.
This commit is contained in:
Markus Mäkelä
2017-07-15 06:59:49 +03:00
parent b98b326bba
commit 3255d58e70
18 changed files with 178 additions and 122 deletions

View File

@ -26,20 +26,25 @@ exports.builder = function(yargs) {
yargs
.command('log-priority <log>', 'Enable log priority [warning|notice|info|debug]', {}, function(argv) {
if (log_levels.indexOf(argv.log) != -1) {
maxctrl(argv)
.updateValue('maxscale/logs', 'data.attributes.parameters.log_' + argv.log, true)
maxctrl(argv, function(host) {
return updateValue(host, 'maxscale/logs', 'data.attributes.parameters.log_' + argv.log, true)
})
} else {
maxctrl(argv)
.error('Invalid log priority: ' + argv.log);
maxctrl(argv, function() {
error('Invalid log priority: ' + argv.log)
return Promise.reject()
})
}
})
.command('maxlog', 'Enable MaxScale logging', {}, function(argv) {
maxctrl(argv)
.updateValue('maxscale/logs', 'data.attributes.parameters.maxlog', true)
maxctrl(argv, function(host) {
return updateValue(host, 'maxscale/logs', 'data.attributes.parameters.maxlog', true)
})
})
.command('syslog', 'Enable syslog logging', {}, function(argv) {
maxctrl(argv)
.updateValue('maxscale/logs', 'data.attributes.parameters.syslog', true)
maxctrl(argv, function(host) {
return updateValue(host, 'maxscale/logs', 'data.attributes.parameters.syslog', true)
})
})
.command('account <name>', 'Activate a Linux user account for administrative use', {}, function(argv) {
var req_body = {
@ -48,8 +53,9 @@ exports.builder = function(yargs) {
type: 'unix'
}
}
maxctrl(argv)
.doRequest('users/unix', null, { method: 'POST', body: req_body})
maxctrl(argv, function(host) {
return doRequest(host, 'users/unix', null, { method: 'POST', body: req_body})
})
})
.usage('Usage: enable <command>')
.help()