MXS-1300: Fix logging and maxscale alteration
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.
This commit is contained in:
@ -34,12 +34,12 @@ exports.builder = function(yargs) {
|
|||||||
})
|
})
|
||||||
.command('logging <key> <value>', 'Alter logging parameters', {}, function(argv) {
|
.command('logging <key> <value>', 'Alter logging parameters', {}, function(argv) {
|
||||||
maxctrl(argv, function(host) {
|
maxctrl(argv, function(host) {
|
||||||
return updateValue(host, 'maxscale/logs', 'attributes.parameters.' + argv.key, argv.value)
|
return updateValue(host, 'maxscale/logs', 'data.attributes.parameters.' + argv.key, argv.value)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.command('maxscale <key> <value>', 'Alter MaxScale parameters', {}, function(argv) {
|
.command('maxscale <key> <value>', 'Alter MaxScale parameters', {}, function(argv) {
|
||||||
maxctrl(argv, function(host) {
|
maxctrl(argv, function(host) {
|
||||||
return updateValue(host, 'maxscale', 'attributes.parameters.' + argv.key, argv.value)
|
return updateValue(host, 'maxscale', 'data.attributes.parameters.' + argv.key, argv.value)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.usage('Usage: alter <command>')
|
.usage('Usage: alter <command>')
|
||||||
|
|||||||
@ -142,6 +142,14 @@ module.exports = function() {
|
|||||||
|
|
||||||
this.updateValue = function(host, resource, key, value) {
|
this.updateValue = function(host, resource, key, value) {
|
||||||
var body = {}
|
var body = {}
|
||||||
|
|
||||||
|
// Convert string booleans into JSON booleans
|
||||||
|
if (value == "true") {
|
||||||
|
value = true
|
||||||
|
} else if (value == "false") {
|
||||||
|
value = false
|
||||||
|
}
|
||||||
|
|
||||||
_.set(body, key, value)
|
_.set(body, key, value)
|
||||||
return doRequest(host, resource, null, { method: 'PATCH', body: body })
|
return doRequest(host, resource, null, { method: 'PATCH', body: body })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user