J. Richard Barnette | 254e80d | 2015-04-20 15:07:51 -0700 | [diff] [blame] | 1 | # By default, we're invoked without arguments. This is how the cron |
| 2 | # job does it, and means we should generate output and mail it to |
| 3 | # the default mail alias. |
| 4 | # |
| 5 | # Invoking with arguments is for testing: It allows running through |
| 6 | # the full logic and output generation, without spamming the alert |
| 7 | # aliases. |
| 8 | |
| 9 | OPTIONS="" |
| 10 | if [ $# -eq 0 ]; then |
| 11 | # TODO(jrbarnette): Really, this feels like a hack. The cron job |
| 12 | # that invokes the inventory scripts is installed and enabled on |
| 13 | # both a primary and backup server, meaning the e-mail will be |
| 14 | # generated twice. We don't want that, so unless this is the |
| 15 | # primary server, quash this job. |
| 16 | if ! cli/atest server list $(hostname) 2>&1 | |
Richard Barnette | 6869c93 | 2018-08-14 13:06:35 -0700 | [diff] [blame] | 17 | grep -q 'STATUS_PRIMARY'; then |
J. Richard Barnette | 254e80d | 2015-04-20 15:07:51 -0700 | [diff] [blame] | 18 | exit 0 |
| 19 | fi |
| 20 | |
| 21 | POOL_INTEREST=( |
Richard Barnette | 5658989 | 2018-06-06 12:02:22 -0700 | [diff] [blame] | 22 | chromeos-test-monitors@google.com |
J. Richard Barnette | 254e80d | 2015-04-20 15:07:51 -0700 | [diff] [blame] | 23 | ) |
Richard Barnette | 5de01eb | 2017-12-15 09:53:42 -0800 | [diff] [blame] | 24 | MODEL_INTEREST=( |
J. Richard Barnette | e78a700 | 2015-05-27 07:27:24 -0700 | [diff] [blame] | 25 | englab-sys-cros@google.com |
Richard Barnette | 5658989 | 2018-06-06 12:02:22 -0700 | [diff] [blame] | 26 | chromeos-test-monitors@google.com |
J. Richard Barnette | 254e80d | 2015-04-20 15:07:51 -0700 | [diff] [blame] | 27 | ) |
| 28 | else |
Richard Barnette | 5de01eb | 2017-12-15 09:53:42 -0800 | [diff] [blame] | 29 | MODEL_INTEREST=( "$@" ) |
J. Richard Barnette | 254e80d | 2015-04-20 15:07:51 -0700 | [diff] [blame] | 30 | POOL_INTEREST=( "$@" ) |
Richard Barnette | 45ac033 | 2017-12-18 16:27:13 -0800 | [diff] [blame] | 31 | OPTIONS=--debug |
J. Richard Barnette | 254e80d | 2015-04-20 15:07:51 -0700 | [diff] [blame] | 32 | fi |
| 33 | |
Richard Barnette | 45ac033 | 2017-12-18 16:27:13 -0800 | [diff] [blame] | 34 | # Options to be used for different script invocations. Inventory |
| 35 | # runs are relatively expensive, so operations that happen rarely |
| 36 | # also bundle operations that happen more frequently. |
Richard Barnette | 1ca30e6 | 2018-04-09 16:45:58 -0700 | [diff] [blame] | 37 | # + UNTESTABLE_DETECT happens with every run. It looks for |
| 38 | # and reports DUTs that for never run tests even though their |
| 39 | # status indicates that they should. |
Richard Barnette | 5de01eb | 2017-12-15 09:53:42 -0800 | [diff] [blame] | 40 | # + MODEL_NOTIFY happens less often. This adds a full model |
Richard Barnette | 45ac033 | 2017-12-18 16:27:13 -0800 | [diff] [blame] | 41 | # inventory count to REPAIR_LOOP_DETECT. |
| 42 | # + POOL_NOTIFY happens least often. It adds per-pool inventory |
| 43 | # counts, as well as individual DUT repair recommendations to |
Richard Barnette | 5de01eb | 2017-12-15 09:53:42 -0800 | [diff] [blame] | 44 | # MODEL_NOTIFY. |
Richard Barnette | 45ac033 | 2017-12-18 16:27:13 -0800 | [diff] [blame] | 45 | |
Richard Barnette | 1ca30e6 | 2018-04-09 16:45:58 -0700 | [diff] [blame] | 46 | UNTESTABLE_DETECT=( --report-untestable ) |
Richard Barnette | 45ac033 | 2017-12-18 16:27:13 -0800 | [diff] [blame] | 47 | |
Richard Barnette | 5de01eb | 2017-12-15 09:53:42 -0800 | [diff] [blame] | 48 | MODEL_NOTIFY=( |
Richard Barnette | 1ca30e6 | 2018-04-09 16:45:58 -0700 | [diff] [blame] | 49 | "${UNTESTABLE_DETECT[@]}" |
Richard Barnette | 5de01eb | 2017-12-15 09:53:42 -0800 | [diff] [blame] | 50 | --model-notify $(echo "${MODEL_INTEREST[@]}" | sed 's/ /,/g') |
J. Richard Barnette | 254e80d | 2015-04-20 15:07:51 -0700 | [diff] [blame] | 51 | ) |
Richard Barnette | 45ac033 | 2017-12-18 16:27:13 -0800 | [diff] [blame] | 52 | |
J. Richard Barnette | 254e80d | 2015-04-20 15:07:51 -0700 | [diff] [blame] | 53 | POOL_NOTIFY=( |
Richard Barnette | 5de01eb | 2017-12-15 09:53:42 -0800 | [diff] [blame] | 54 | "${MODEL_NOTIFY[@]}" |
Richard Barnette | 3d08dc8 | 2017-02-16 15:27:39 -0800 | [diff] [blame] | 55 | --recommend=40 |
Richard Barnette | 45ac033 | 2017-12-18 16:27:13 -0800 | [diff] [blame] | 56 | --pool-notify $(echo "${POOL_INTEREST[@]}" | sed 's/ /,/g') |
J. Richard Barnette | 254e80d | 2015-04-20 15:07:51 -0700 | [diff] [blame] | 57 | ) |