update salt trend query, fix some respon states
Change-Id: I10181f0d4d50e5b622fb8daa4e19454a64d242eb
diff --git a/salt-state-apply-trend.sh b/salt-state-apply-trend.sh
index e7e83ea..7edba2e 100755
--- a/salt-state-apply-trend.sh
+++ b/salt-state-apply-trend.sh
@@ -4,10 +4,12 @@
# Aggregate succeeded/failed/changes per node on a dry run.
salt \* state.apply --out=json --static test=true -b15 | jq -r 'to_entries | map({ key:.key, value: { total: [.value[]]|length ,
- succeed: [.value[]|select(.result == true)]|length,
- failed: [.value[]|select(.result == false)]|length,
- changes: [select(.value[].changes|length > 0)]|length } }) | from_entries ' |\
+ succeed: [select(.value>={})|.value[]|select(.result? == true )]|length,
+ failed: [select(.value>={})|.value[]|select(.result? == false)]|length,
+ null: [select(.value>={})|.value[]|select(.result? == null)]|length,
+ changes: [select(.value>={})|.value[]|select(.changes?|length > 0)]|length } }) | from_entries ' |\
tee trend_$(date "+%Y-%m-%d-%s").json
+
# to review
ls trend*.json| sort |tail -n2 |xargs -n2 diff -y | colordiff