From c5a835c3918cd1c81960e42fd1c155f820c3c66a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 17 Sep 2021 04:55:14 +0200 Subject: [PATCH] autodns: misc fixes/enh --- data/other/config_domain.toml | 12 ++++++------ data/other/registrar_list.toml | 2 ++ src/yunohost/dns.py | 13 +++++++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/data/other/config_domain.toml b/data/other/config_domain.toml index af23b5e04..095e561a1 100644 --- a/data/other/config_domain.toml +++ b/data/other/config_domain.toml @@ -13,7 +13,7 @@ i18n = "domain_config" [feature] [feature.mail] - services = ['postfix', 'dovecot'] + #services = ['postfix', 'dovecot'] [feature.mail.mail_out] type = "boolean" @@ -23,11 +23,11 @@ i18n = "domain_config" type = "boolean" default = 1 - [feature.mail.backup_mx] - type = "tags" - default = [] - pattern.regexp = '^([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+((xn--)?[^\W_]{2,})$' - pattern.error = "pattern_error" + #[feature.mail.backup_mx] + #type = "tags" + #default = [] + #pattern.regexp = '^([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+((xn--)?[^\W_]{2,})$' + #pattern.error = "pattern_error" [feature.xmpp] diff --git a/data/other/registrar_list.toml b/data/other/registrar_list.toml index 406066dc9..afb213aa1 100644 --- a/data/other/registrar_list.toml +++ b/data/other/registrar_list.toml @@ -230,6 +230,8 @@ type = "string" choices.rpc = "RPC" choices.rest = "REST" + default = "rest" + visible = "false" [gehirn] [gehirn.auth_token] diff --git a/src/yunohost/dns.py b/src/yunohost/dns.py index 1e2037ce5..07e5297d5 100644 --- a/src/yunohost/dns.py +++ b/src/yunohost/dns.py @@ -26,7 +26,6 @@ import os import re import time -import hashlib from difflib import SequenceMatcher from collections import OrderedDict @@ -506,6 +505,15 @@ def _get_registrar_config_section(domain): "ask": f"YunoHost automatically detected that this domain is handled by the registrar **{registrar}**. If you want, YunoHost will automatically configure this DNS zone, if you provide it with the appropriate API credentials. You can also manually configure your DNS records following the documentation as https://yunohost.org/dns.", # FIXME: i18n "value": registrar }) + + TESTED_REGISTRARS = ["ovh", "gandi"] + if registrar not in TESTED_REGISTRARS: + registrar_infos["experimental_disclaimer"] = OrderedDict({ + "type": "alert", + "style": "danger", + "ask": f"So far, the interface with **{registrar}**'s API has not been properly tested and reviewed by the YunoHost's community. Support is **very experimental** - be careful!", # FIXME: i18n + }) + # TODO : add a help tip with the link to the registar's API doc (c.f. Lexicon's README) registrar_list = read_toml(DOMAIN_REGISTRAR_LIST_PATH) registrar_credentials = registrar_list[registrar] @@ -572,6 +580,7 @@ def domain_dns_push(operation_logger, domain, dry_run=False, force=False, purge= # See https://github.com/AnalogJ/lexicon/issues/282 and https://github.com/AnalogJ/lexicon/pull/371 # They say it's trivial to implement it! # And yet, it is still not done/merged + # Update by Aleks: it works - at least with Gandi ?! #wanted_records = [record for record in wanted_records if record["type"] != "CAA"] if purge: @@ -756,7 +765,7 @@ def domain_dns_push(operation_logger, domain, dry_run=False, force=False, purge= # If --force ain't used, we won't delete/update records not managed by yunohost if not force: for action in ["delete", "update"]: - changes[action] = [r for r in changes[action] if not r["managed_by_yunohost"]] + changes[action] = [r for r in changes[action] if r["managed_by_yunohost"]] def progress(info=""): progress.nb += 1