mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-21 11:50:43 +00:00
File notification and JSON output fixes (#281)
* File notification and JSON output fixes * Truncate notify file(s) on first write and then append * Strip wrapping double quotes from Dockcheck update tempcsv variable before jsonification * Eliminate separate truncate step
This commit is contained in:
@@ -205,7 +205,7 @@ format_output() {
|
||||
FormattedOutput=$(jq --compact-output --null-input --arg updates "${tempcsv}" '($updates | split("\\n")) | map(split(",")) | {"updates": map({"script_name": .[0], "installed_version": .[1], "latest_version": .[2]})}')
|
||||
elif [[ "${UpdateType}" == "dockcheck_update" ]]; then
|
||||
# dockcheck update case
|
||||
FormattedOutput=$(jq --compact-output --null-input --arg updates "${tempcsv}" '($updates | split("\\n")) | map(split(",")) | {"updates": map({"script_name": .[0], "installed_version": .[1], "latest_version": .[2], "release_notes": (.[3:] | join(","))})}')
|
||||
FormattedOutput=$(jq --compact-output --null-input --arg updates "${tempcsv//\"/}" '($updates | split("\\n")) | map(split(",")) | {"updates": map({"script_name": .[0], "installed_version": .[1], "latest_version": .[2], "release_notes": (.[3:] | join(","))})}')
|
||||
else
|
||||
FormattedOutput="Invalid input"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user