Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # source: https://gist.github.com/epcim/e488af8be69b616eab3088a14a937e14 |
| 3 | |
| 4 | # Aggregate succeeded/failed/changes per node on a dry run. |
| 5 | |
| 6 | salt \* state.apply --out=json --static test=true -b15 | jq -r 'to_entries | map({ key:.key, value: { total: [.value[]]|length , |
Petr Michalec | 79d7b0a | 2018-08-01 15:08:53 +0200 | [diff] [blame] | 7 | succeed: [select(.value>={})|.value[]|select(.result? == true )]|length, |
| 8 | failed: [select(.value>={})|.value[]|select(.result? == false)]|length, |
| 9 | null: [select(.value>={})|.value[]|select(.result? == null)]|length, |
| 10 | changes: [select(.value>={})|.value[]|select(.changes?|length > 0)]|length } }) | from_entries ' |\ |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 11 | tee trend_$(date "+%Y-%m-%d-%s").json |
| 12 | |
Petr Michalec | 79d7b0a | 2018-08-01 15:08:53 +0200 | [diff] [blame] | 13 | |
Ales Komarek | 1b37311 | 2017-08-08 08:48:56 +0200 | [diff] [blame] | 14 | # to review |
| 15 | ls trend*.json| sort |tail -n2 |xargs -n2 diff -y | colordiff |