-
Notifications
You must be signed in to change notification settings - Fork 364
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
Incorrect hosted zone match #1190
Labels
Comments
What is the expected result? |
It should select |
@sridhar562345 I attempted an improvement PR, can you check it out and let me know if it meets your expectations? |
I was actually working on it as well and I guess I have a better logic to verify this. Here is my logic @staticmethod
def get_best_match_zone(all_zones, domain):
"""Return zone id which name is closer matched with domain name."""
# Related: https://github.com/Miserlou/Zappa/issues/459
public_zones = [zone for zone in all_zones['HostedZones'] if not zone['Config']['PrivateZone']]
zones = {zone['Name'][:-1]: zone['Id'] for zone in public_zones if zone['Name'][:-1] == domain}
if not zones:
zones = {zone['Name'][:-1]: zone['Id'] for zone in public_zones if '.' + zone['Name'][:-1] in domain}
if zones:
keys = max(zones.keys(), key=lambda a: len(a)) # get longest key -- best match.
return zones[keys]
else:
return None |
Thanks! |
monkut
added a commit
that referenced
this issue
Dec 1, 2022
* 📝 CHANGELOG.md update for 0.55.1 release * 📝 add merged PR (#1177) related issues to CHANGELOG. * 📝 add #1117 to list after merge. * 📝 adding resolved issue to CHANGELOG * 🔧 0.55.1 -> 0.56.0 📝 add merged issue to changelog. * 📝 add #1190 * 🔧 `Pipfile` (pipenv) now used in place of requirements.txt, test_requirements.txt, requirements.in test_requirements.in. Replacing in MANIFEST.in. Related Issue: #1199 * 🔧 Add resolved issue #1199
released in 0.56.0, closing. |
Ian288
pushed a commit
to tackle-io/Zappa
that referenced
this issue
Jul 11, 2023
* 📝 CHANGELOG.md update for 0.55.1 release * 📝 add merged PR (zappa#1177) related issues to CHANGELOG. * 📝 add zappa#1117 to list after merge. * 📝 adding resolved issue to CHANGELOG * 🔧 0.55.1 -> 0.56.0 📝 add merged issue to changelog. * 📝 add zappa#1190 * 🔧 `Pipfile` (pipenv) now used in place of requirements.txt, test_requirements.txt, requirements.in test_requirements.in. Replacing in MANIFEST.in. Related Issue: zappa#1199 * 🔧 Add resolved issue zappa#1199
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Zappa/zappa/core.py
Lines 3197 to 3208 in 9b2a98c
Suppose there are two hosted zones
api.in
andbeta.api.in
and domain name specified issome-beta.api.in
The current logic selects hosted
beta.api.in
as the hosted zone for the specified domain.The text was updated successfully, but these errors were encountered: