From 7af2ce659d23585137ee26dffcdff859657df73c Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 8 Jul 2018 14:20:00 -0700 Subject: [PATCH] scripts/maintenance: Dependency checks for tag-aws.sh and clean-aws.sh Following the pattern set by tag-route53-hosted-zones.sh. I'm also following tag-route53-hosted-zones.sh in not testing for any POSIX commands we use, although it would be easy to add tests for them as well if we wanted. --- scripts/maintenance/clean-aws.sh | 6 ++++++ scripts/maintenance/tag-aws.sh | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/maintenance/clean-aws.sh b/scripts/maintenance/clean-aws.sh index de42ad2240..82edcc05bf 100755 --- a/scripts/maintenance/clean-aws.sh +++ b/scripts/maintenance/clean-aws.sh @@ -4,6 +4,7 @@ usage() { cat </dev/null || ! command -V jq >/dev/null; then + echo "Missing required dependencies" >&2 + exit 1 +fi + if [ -n "$AWS_REGION" ]; then region="${AWS_REGION:-}" fi diff --git a/scripts/maintenance/tag-aws.sh b/scripts/maintenance/tag-aws.sh index 400374e937..081bda3020 100755 --- a/scripts/maintenance/tag-aws.sh +++ b/scripts/maintenance/tag-aws.sh @@ -5,8 +5,8 @@ usage() { $(basename "$0") tags AWS resources with 'expirationDate: some-date-string', defaulting to the following days' date, and excludes all resources tagged with -tag keys/values specified in an 'exclude' file. Requires that both 'jq' and the -AWS CLI are installed. +tag keys/values specified in an 'exclude' file. Requires that 'docker' is +installed. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environmental variables must be set. @@ -107,6 +107,11 @@ while [ $# -gt 0 ]; do shift done +if ! command -V docker >/dev/null; then + echo "Missing required dependencies" >&2 + exit 1 +fi + if [ -n "$AWS_REGION" ]; then region="${AWS_REGION:-}" fi