From 12616b3da02600a27922dc1e275886c3b80ca1f8 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 23 Jan 2025 20:46:59 +0100 Subject: ntp: T6911: fix migration script to not allow empty "service ntp" CLI node With T3008 we moved from ntpd to chrony. This came with a restructuring of the CLI (mainly moving ntp out of system to services). In addition the definition of a server was made mandatory. The bug itself manifests at a more crucial point - config migration vyos-router[1265]: Migration script error: /opt/vyatta/etc/config-migrate/migrate/ntp/1-to-2: [Errno 1] failed to run command: ['/opt/vyatta/etc/config-migrate/migrate/ntp/1-to-2', '/opt/vyatta/etc/config/config.boot'] vyos-router[1265]: returned: - op: copy old_path: ['system', 'ntp'] new_path: ['service', 'ntp'] vyos-router[1265]: - op: delete path: ['system', 'ntp'] The fix is that we will no longer migrate an empty ntp CLI node from the old syntax to the new. --- src/migration-scripts/ntp/1-to-2 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/migration-scripts/ntp/1-to-2 b/src/migration-scripts/ntp/1-to-2 index fd7b08221..d5f800922 100644 --- a/src/migration-scripts/ntp/1-to-2 +++ b/src/migration-scripts/ntp/1-to-2 @@ -1,4 +1,4 @@ -# Copyright 2023-2024 VyOS maintainers and contributors +# Copyright 2023-2025 VyOS maintainers and contributors # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -25,6 +25,11 @@ def migrate(config: ConfigTree) -> None: # Nothing to do return + # T6911: do not migrate NTP configuration if mandatory server is missing + if not config.exists(base_path + ['server']): + config.delete(base_path) + return + # config.copy does not recursively create a path, so create ['service'] if # it doesn't yet exist, such as for config.boot.default if not config.exists(['service']): -- cgit v1.2.3