Skip to content

Commit

Permalink
Merge pull request #165 from cevich/further_limit_dh_by_tag
Browse files Browse the repository at this point in the history
Allow dividing DH pool based on tag name/value
  • Loading branch information
cevich authored Dec 5, 2023
2 parents 20df1f7 + a9eb5b1 commit 8d8e12b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mac_pw_pool/LaunchInstances.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ inst_failure() {
}

# Find dedicated hosts to operate on.
dh_flt="Name=tag:Name,Values=MacM1-*"
dh_name_flt="Name=tag:Name,Values=MacM1-*"
dh_tag_flt="Name=tag:$DH_REQ_TAG,Values=$DH_REQ_VAL"
dh_qry='Hosts[].{HostID:HostId, Name:[Tags[?Key==`Name`].Value][] | [0]}'
dh_searchout="$TEMPDIR/hosts.output" # JSON or error message
if ! $AWS ec2 describe-hosts --filter "$dh_flt" --query "$dh_qry" &> "$dh_searchout"; then
if ! $AWS ec2 describe-hosts --filter "$dh_name_flt" "$dh_tag_flt" --query "$dh_qry" &> "$dh_searchout"; then
die "Searching for dedicated hosts $(ctx 0):
$(<$dh_searchout)"
fi
Expand Down
4 changes: 4 additions & 0 deletions mac_pw_pool/pw_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ LIB_DIRPATH=$(dirname "${BASH_SOURCE[0]}")
TEMPDIR=$(mktemp -d -p '' "${SCRIPT_FILENAME}_XXXXX.tmp")
trap "rm -rf '$TEMPDIR'" EXIT

# Only manage dedicated hosts with the following tag & value
DH_REQ_TAG="purpose"
DH_REQ_VAL="prod"

# Path to file recording the most recent state of each dedicated host.
# Format is simply one line per dedicated host, with it's name, instance id, start
# date/time separated by a space. Exceptional conditions are recorded as comments
Expand Down

0 comments on commit 8d8e12b

Please sign in to comment.