MXS-1929: Check presence of filter parameters

The parameters were made optional as not all filters require parameters.
This commit is contained in:
Markus Mäkelä 2018-08-07 23:44:42 +03:00
parent 785507b002
commit 25bc385db2
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -221,12 +221,15 @@ exports.builder = function(yargs) {
'data': {
'id': argv.name,
'attributes': {
'module': argv.module,
'parameters': argv.params.reduce(to_obj, {})
'module': argv.module
}
}
}
if (argv.params) {
filter.data.attributes.parameters = argv.params.reduce(to_obj, {})
}
maxctrl(argv, function(host) {
return doRequest(host, 'filters', null, {method: 'POST', body: filter})
})