blob: 37f61e69224efb15e77f8bc96f6cdc79431a1fe9 [file] [log] [blame]
# By default, we're invoked without arguments. This is how the cron
# job does it, and means we should generate output and mail it to
# the default mail alias.
#
# Invoking with arguments is for testing: It allows running through
# the full logic and output generation, without spamming the alert
# aliases.
OPTIONS=""
if [ $# -eq 0 ]; then
# TODO(jrbarnette): Really, this feels like a hack. The cron job
# that invokes the inventory scripts is installed and enabled on
# both a primary and backup server, meaning the e-mail will be
# generated twice. We don't want that, so unless this is the
# primary server, quash this job.
if ! cli/atest server list $(hostname) 2>&1 |
grep -q '^Status *: *primary'; then
exit 0
fi
POOL_INTEREST=(
chromeos-infra-eng@grotations.appspotmail.com
chromeos-lab-alerts@google.com
)
BOARD_INTEREST=(
englab-sys-cros@google.com
chromeos-lab-alerts@google.com
)
else
BOARD_INTEREST=( "$@" )
POOL_INTEREST=( "$@" )
OPTIONS=--print
fi
BOARD_NOTIFY=(
--board-notify
$(echo "${BOARD_INTEREST[@]}" | sed 's/ /,/g')
)
POOL_NOTIFY=(
--recommend=20
--pool-notify
$(echo "${POOL_INTEREST[@]}" | sed 's/ /,/g')
)