diff options
-rwxr-xr-x | update.sh | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -47,10 +47,25 @@ if [ "$config_ip" != "$actual_ip" ]; then ] } EOF - aws route53 change-resource-record-sets \ + res=$(aws route53 change-resource-record-sets \ --hosted-zone-id $HOSTED_ZONE_ID \ - --change-batch "file://$RECORD_CHANGE_JSON" - + --change-batch "file://$RECORD_CHANGE_JSON") + status=$(jq -r '.ChangeInfo.Status' $res) + + if [ "$status" == "PENDING" ]; then + echo "Change submitted. Overall is Pending! (This is expected)" + exit 0 + else + + if [ "$status" == "SUCCESS" ]; then + echo "Change successful" + exit 0 + else + echo "Non-successful status code: $status" + exit 1 + fi + fi + else echo "$DOMAIN is currently registered properly: $config_ip $actual_ip" fi |