#!/bin/sh
set -xe

[ "$(id -un)" = andersk ]

eval "$(attach -Padd -b tooltime)"

locker="$1"
contact="$2"
shift 2

subject="ACTION REQUIRED: Update DNS for your host${2+s} on Scripts: $*"
{ rt_out=$(rt create -t ticket set subject="$subject" queue=Scripts requestors="$contact" owner=andersk | tee /dev/fd/5); } 5>&1
ticket=$(echo "$rt_out" | sed -n 's/# Ticket \([0-9]\+\) created./\1/ p')
[ -n "$ticket" ]
mail scripts@mit.edu -s "$subject  [help.mit.edu #$ticket]" <<EOF
You are receiving this message as an administrator of the $locker
Athena locker, from which the following hostname(s) are served on
scripts.mit.edu:

$(printf '%s\n' "$@")

These hostname(s) are currently connected to the Scripts server via a
DNS A record for 18.181.0.46.  As a result of IS&T selling a large
portion of MIT’s IPv4 address space to Amazon, we have been forced to
migrate the Scripts server to a new address.  To keep your hostname(s)
working, you must update your DNS records to follow this migration.

*** Specifically: you need to update these A records from the old
address ‘18.181.0.46’ to the new address ‘18.4.86.46’. ***

Alternatively, you may be able to replace the A record with a CNAME
record for ‘scripts-vhosts.mit.edu.’, keeping in mind the caveats
noted in our FAQ at https://scripts.mit.edu/faq/14.

These changes must be made with your domain registrar or external DNS
provider.  There is no need to respond to this notice or otherwise
contact the Scripts team.

(The Scripts team does not control your DNS and cannot make the
updates for you.  While we may be able to provide advice on a
best-effort volunteer basis, keep in mind that we are sending similar
notices regarding nearly 300 hostnames, so responses, if any, may be
delayed.)

Both the old and new addresses are functional at present, but you must
change to the new address by June 12: at that point, the old address
18.181.0.46 will stop pointing to Scripts and might be repurposed by
some arbitrary Amazon cloud customer.

We apologize for any inconvenience.

Anders
SIPB scripts team
/set status=resolved
EOF
#rt edit "ticket/$ticket" set status=resolved
