From 571b0db7cf7878e353857f51da7f1e41fdcca354 Mon Sep 17 00:00:00 2001
From: John Estabrook <jestabro@vyos.io>
Date: Thu, 26 Jan 2023 13:07:59 -0600
Subject: ntp: T4961: create path ['service'] if it doesn't exist

config.copy does not recursively create nodes of the path. On install
image, the path ['service'] is not present in config.boot.default, so
must be created before config.copy['service', 'ntp'].
---
 src/migration-scripts/ntp/1-to-2 | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src/migration-scripts')

diff --git a/src/migration-scripts/ntp/1-to-2 b/src/migration-scripts/ntp/1-to-2
index 4a701e7e5..d1e510e4c 100755
--- a/src/migration-scripts/ntp/1-to-2
+++ b/src/migration-scripts/ntp/1-to-2
@@ -37,6 +37,11 @@ if not config.exists(base_path):
     # Nothing to do
     sys.exit(0)
 
+# 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']):
+    config.set(['service'])
+
 # copy "system ntp" to "service ntp"
 config.copy(base_path, new_base_path)
 config.delete(base_path)
-- 
cgit v1.2.3