ENT-8193: Added validfiledata policy function - #6267
Conversation
9e45cd8 to
9703b8e
Compare
845b012 to
a638a1c
Compare
Changelog: Title Ticket: ENT-8193 Signed-off-by: Victor Moene <victor.moene@northern.tech>
larsewi
left a comment
There was a problem hiding this comment.
Did you try reusing ValidateDataGeneric?
I think |
| bundle agent generate_files(template, data) | ||
| { | ||
| vars: | ||
| "content" string => string_mustache("$(template[mustache])", @(data)); |
There was a problem hiding this comment.
Seems a bit overly complicated to use mustache templates here. Is it not easier to just write the content directly? It may be a little bit more code, but easier to read / understand when debugging this in the future.
Also I'd prefer using the test directory variables from default.sub.cf instead of polluting the /tmp/ directory.
|
|
||
| JsonElement *json = JsonReadDataFile(fp->name, input_path, requested_mode, CF_INFINITY, false); | ||
| bool is_valid = (json != NULL); | ||
| JsonDestroy(json); |
There was a problem hiding this comment.
Reading large files into memory just to delete them afterwards is a bit memory inefficient. But this is probably out of scope for this PR. Hence, I created a follow-up ticket CFE-4706.
depends_on: NorthernTechHQ/libntech#288