diff options
| author | Daniil Baturin <daniil@vyos.io> | 2026-08-14 14:00:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-14 14:00:14 +0100 |
| commit | 0775edcd1eaa668d789f0ee9d00da14f11e7c1dd (patch) | |
| tree | 4dddcf103c5ce139610348eb455e58dcc2c8e135 /src/migration-scripts | |
| parent | b9aa488683764efc9901b4ba1ae236f485b1c083 (diff) | |
| parent | ced95444e5233c4fef5e274220dc665bbe836e69 (diff) | |
| download | vyos-1x-0775edcd1eaa668d789f0ee9d00da14f11e7c1dd.tar.gz vyos-1x-0775edcd1eaa668d789f0ee9d00da14f11e7c1dd.zip | |
Merge pull request #5123 from indrajitr/ddclient-v4
ddclient: T6981: Upgrade ddclient to v4.0.0
Diffstat (limited to 'src/migration-scripts')
| -rw-r--r-- | src/migration-scripts/dns-dynamic/4-to-5 | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/migration-scripts/dns-dynamic/4-to-5 b/src/migration-scripts/dns-dynamic/4-to-5 new file mode 100644 index 000000000..3873c00af --- /dev/null +++ b/src/migration-scripts/dns-dynamic/4-to-5 @@ -0,0 +1,53 @@ +# Copyright VyOS maintainers and contributors <maintainers@vyos.io> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library. If not, see <http://www.gnu.org/licenses/>. + +# T6981: +# - remove "service dns dynamic name <service> protocol googledomains" +# - remove "service dns dynamic name <service> protocol woima" +# - remove "service dns dynamic name <service> address web url ..." +# when url is https://domains.google.com/* + +import re +from vyos.base import Warning +from vyos.configtree import ConfigTree + +base_path = ['service', 'dns', 'dynamic', 'name'] + +def migrate(config: ConfigTree) -> None: + if not config.exists(base_path): + # Nothing to do + return + + for service in config.list_nodes(base_path): + + service_path = base_path + [service] + + # Remove configurations using protocol 'googledomains' and 'woima' + if config.exists(service_path + ['protocol']): + protocol = config.return_value(service_path + ['protocol']) + if protocol in ['googledomains', 'woima']: + Warning(f'Removing {service} using protocol "{protocol}" because the service has been shutdown') + config.delete(service_path) + + # Look for 'address web' with 'url' set to 'googledomains' or 'https://domains.google.com' + # and remove them so that ddclient defaults apply for 'address web' + if config.exists(service_path + ['address', 'web']): + web_addr_path = service_path + ['address', 'web'] + if config.exists(web_addr_path + ['url']): + url = config.return_value(web_addr_path + ['url']) + if url == 'googledomains' or re.search(r'^(https?://)?domains\.google\.com', url): + config.delete(web_addr_path + ['url']) + if config.exists(web_addr_path + ['skip']): + config.delete(web_addr_path + ['skip']) |
