summaryrefslogtreecommitdiff
path: root/src/migration-scripts/l2tp/8-to-9
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-02-15 15:09:07 +0000
committerGitHub <noreply@github.com>2024-02-15 15:09:07 +0000
commit2bc62337b3a1474bba3e1027292ca8d0e443b297 (patch)
tree32c69c3091590069626446611174c3f61d00b7d1 /src/migration-scripts/l2tp/8-to-9
parent71497e76c9cf0724581505f50e8b78b6e1c47316 (diff)
parentac6a16f6c5ad7700789759e1ec093236c2e182a2 (diff)
downloadvyos-1x-2bc62337b3a1474bba3e1027292ca8d0e443b297.tar.gz
vyos-1x-2bc62337b3a1474bba3e1027292ca8d0e443b297.zip
Merge pull request #3004 from aapostoliuk/T6029-circinus
T6029: Rewritten Accel-PPP services to an identical feature set
Diffstat (limited to 'src/migration-scripts/l2tp/8-to-9')
-rwxr-xr-xsrc/migration-scripts/l2tp/8-to-949
1 files changed, 49 insertions, 0 deletions
diff --git a/src/migration-scripts/l2tp/8-to-9 b/src/migration-scripts/l2tp/8-to-9
new file mode 100755
index 000000000..e85a3892b
--- /dev/null
+++ b/src/migration-scripts/l2tp/8-to-9
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2024 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Deleted 'dhcp-interface' from l2tp
+
+import os
+
+from sys import argv
+from sys import exit
+from vyos.configtree import ConfigTree
+
+
+if len(argv) < 2:
+ print("Must specify file name!")
+ exit(1)
+
+file_name = argv[1]
+
+with open(file_name, 'r') as f:
+ config_file = f.read()
+
+config = ConfigTree(config_file)
+base = ['vpn', 'l2tp', 'remote-access']
+if not config.exists(base):
+ exit(0)
+
+#deleting unused dhcp-interface
+if config.exists(base + ['dhcp-interface']):
+ config.delete(base + ['dhcp-interface'])
+
+try:
+ with open(file_name, 'w') as f:
+ f.write(config.to_string())
+except OSError as e:
+ print("Failed to save the modified config: {}".format(e))
+ exit(1)