Open patrickdk77 opened 4 years ago
I think the text formatting ate some important punctuation. This is what worked for me:
function find_zone() {
local DOMAIN="${1}"
local ZONELIST=$(cli53 list -format json | jq --raw-output '.[] | select(.Config.PrivateZone == false) | .Name, .Id' | sed -e 's/\.$//' | xargs echo -n | sed -e 's# /hostedzone/#|#g')
local TESTDOMAIN="${DOMAIN}"
local DOM=""
local ID=""
while [[ -n "$TESTDOMAIN" ]]; do
for zone in $ZONELIST; do
ID="${zone##*|}"
DOM="${zone%|*}"
if [[ "$DOM" == "$TESTDOMAIN" ]]; then
echo "$ID"
return 0
fi
done
TESTDOMAIN=$(get_base_name "$TESTDOMAIN")
done
return 1
}
I also had to add export PATH="$PATH:/usr/local/bin"
as that's where cli53 is.
Looks to have ate the *'s
Quoting Sven Edge @.***>:
I think the text formatting ate some important punctuation. This is
what worked for me:function find_zone() { local DOMAIN="${1}" local ZONELIST=$(cli53 list -format json | jq --raw-output '.[] | select(.Config.PrivateZone == false) | .Name, .Id' | sed -e 's/\.$//' | xargs echo -n | sed -e 's# /hostedzone/#|#g') local TESTDOMAIN="${DOMAIN}" local DOM="" local ID="" while [[ -n "$TESTDOMAIN" ]]; do for zone in $ZONELIST; do ID="${zone##*|}" DOM="${zone%|*}" if [[ "$DOM" == "$TESTDOMAIN" ]]; then echo "$ID" return 0 fi done TESTDOMAIN=$(get_base_name "$TESTDOMAIN") done return 1 }
I also had to add
export PATH="$PATH:/usr/local/bin"
as that's
where cli53 is.-- Reply to this email directly or view it on GitHub: https://github.com/whereisaaron/dehydrated-route53-hook-script/issues/5#issuecomment-1693414096 You are receiving this because you authored the thread.
Message ID:
@.***>
simple modifications to work with private zones.
local ZONELIST=$(cli53 list -format json | jq --raw-output '.[] | select(.Config.PrivateZone == false) | .Name, .Id' | sed -e 's/.$//' | xargs echo -n | sed -e 's/ \/hostedzone\//|/g')
local TESTDOMAIN="${DOMAIN}" local DOM="" local ID=""
while [[ -n "$TESTDOMAIN" ]]; do for zone in $ZONELIST; do ID="${zone##|}" DOM="${zone%|}" if [[ "$DOM" == "$TESTDOMAIN" ]]; then echo "$ID" return 0 fi done TESTDOMAIN=$(get_base_name "$TESTDOMAIN") done