If UCI store values as a list instead of an option, conversation for the
collectd configuration is not work correctly. This is due to the use of
a DynamicList type element in the UI (for example, for the RRATimespans
field). For this function argument val receives as array instead of a
string, so no additional conversion is required.
Signed-off-by: Aleksey Kolosov <[email protected]>
const preprocess = {
RRATimespans: function(val) {
- return join(' ', map(split(val, /\s+/), parse_units));
+ return join(' ', map(type(val) == 'array' ? val : split(val, /\s+/), parse_units));
}
};