diff options
author | Christian Breunig <christian@breunig.cc> | 2025-01-23 20:46:59 +0100 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2025-01-23 21:12:16 +0100 |
commit | 12616b3da02600a27922dc1e275886c3b80ca1f8 (patch) | |
tree | faa0726f1994236c067531ad433ea4bbd230eb8f /src/migration-scripts | |
parent | 62680c883d440285fe399bcc9fa7591648542dae (diff) | |
download | vyos-1x-12616b3da02600a27922dc1e275886c3b80ca1f8.tar.gz vyos-1x-12616b3da02600a27922dc1e275886c3b80ca1f8.zip |
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.
Diffstat (limited to 'src/migration-scripts')
-rw-r--r-- | src/migration-scripts/ntp/1-to-2 | 7 |
1 files changed, 6 insertions, 1 deletions
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 <maintainers@vyos.io> +# Copyright 2023-2025 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 @@ -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']): |