Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesnt work with private zones #5

Open
patrickdk77 opened this issue Mar 21, 2020 · 2 comments
Open

Doesnt work with private zones #5

patrickdk77 opened this issue Mar 21, 2020 · 2 comments

Comments

@patrickdk77
Copy link

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

@svenedge
Copy link

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.

@patrickdk77
Copy link
Author

patrickdk77 commented Aug 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants