blob: 7edba2e01d828e6337e9721981a36eda6c688926 [file] [log] [blame]
Ales Komarek1b373112017-08-08 08:48:56 +02001#!/bin/bash
2# source: https://gist.github.com/epcim/e488af8be69b616eab3088a14a937e14
3
4# Aggregate succeeded/failed/changes per node on a dry run.
5
6salt \* state.apply --out=json --static test=true -b15 | jq -r 'to_entries | map({ key:.key, value: { total: [.value[]]|length ,
Petr Michalec79d7b0a2018-08-01 15:08:53 +02007 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 Komarek1b373112017-08-08 08:48:56 +020011 tee trend_$(date "+%Y-%m-%d-%s").json
12
Petr Michalec79d7b0a2018-08-01 15:08:53 +020013
Ales Komarek1b373112017-08-08 08:48:56 +020014# to review
15ls trend*.json| sort |tail -n2 |xargs -n2 diff -y | colordiff