mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix dns zone for dynette domains (otherwise breaks dyndns update)
This commit is contained in:
parent
8a82fe0392
commit
da1b9089bf
2 changed files with 7 additions and 4 deletions
|
@ -428,7 +428,8 @@ def _get_dns_zone_for_domain(domain):
|
||||||
# ... otherwise we end up constantly doing a bunch of dig requests
|
# ... otherwise we end up constantly doing a bunch of dig requests
|
||||||
for ynh_dyndns_domain in YNH_DYNDNS_DOMAINS:
|
for ynh_dyndns_domain in YNH_DYNDNS_DOMAINS:
|
||||||
if domain.endswith("." + ynh_dyndns_domain):
|
if domain.endswith("." + ynh_dyndns_domain):
|
||||||
return ynh_dyndns_domain
|
# Keep only foo.nohost.me even if we have subsub.sub.foo.nohost.me
|
||||||
|
return '.'.join(domain.rsplit('.', 3)[-3:])
|
||||||
|
|
||||||
# Check cache
|
# Check cache
|
||||||
cache_folder = "/var/cache/yunohost/dns_zones"
|
cache_folder = "/var/cache/yunohost/dns_zones"
|
||||||
|
@ -520,7 +521,7 @@ def _get_registrar_config_section(domain):
|
||||||
|
|
||||||
# TODO big project, integrate yunohost's dynette as a registrar-like provider
|
# TODO big project, integrate yunohost's dynette as a registrar-like provider
|
||||||
# TODO big project, integrate other dyndns providers such as netlib.re, or cf the list of dyndns providers supported by cloudron...
|
# TODO big project, integrate other dyndns providers such as netlib.re, or cf the list of dyndns providers supported by cloudron...
|
||||||
if dns_zone in YNH_DYNDNS_DOMAINS:
|
if any(dns_zone.endswith('.' + ynh_dyndns_domain) for ynh_dyndns_domain in YNH_DYNDNS_DOMAINS):
|
||||||
registrar_infos["registrar"] = OrderedDict(
|
registrar_infos["registrar"] = OrderedDict(
|
||||||
{
|
{
|
||||||
"type": "alert",
|
"type": "alert",
|
||||||
|
|
|
@ -34,8 +34,10 @@ def test_get_dns_zone_from_domain_existing():
|
||||||
assert (
|
assert (
|
||||||
_get_dns_zone_for_domain("non-existing-domain.yunohost.org") == "yunohost.org"
|
_get_dns_zone_for_domain("non-existing-domain.yunohost.org") == "yunohost.org"
|
||||||
)
|
)
|
||||||
assert _get_dns_zone_for_domain("yolo.nohost.me") == "nohost.me"
|
assert _get_dns_zone_for_domain("yolo.nohost.me") == "yolo.nohost.me"
|
||||||
assert _get_dns_zone_for_domain("foo.yolo.nohost.me") == "nohost.me"
|
assert _get_dns_zone_for_domain("foo.yolo.nohost.me") == "yolo.nohost.me"
|
||||||
|
assert _get_dns_zone_for_domain("bar.foo.yolo.nohost.me") == "yolo.nohost.me"
|
||||||
|
|
||||||
assert _get_dns_zone_for_domain("yolo.tld") == "yolo.tld"
|
assert _get_dns_zone_for_domain("yolo.tld") == "yolo.tld"
|
||||||
assert _get_dns_zone_for_domain("foo.yolo.tld") == "yolo.tld"
|
assert _get_dns_zone_for_domain("foo.yolo.tld") == "yolo.tld"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue