summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-12-08 07:35:36 +0100
committerGitHub <noreply@github.com>2023-12-08 07:35:36 +0100
commit8a00ac1b1126c79eee197f4e5ae59689e942c881 (patch)
treee154b9c294a4700ea4bfcf17a950a8579a4a2ebf
parentc328e7eb4f9d619d33a250f6686464197b64ed86 (diff)
parent237b71a89160f28e5c603bacf707b1c235f01026 (diff)
downloadvyos-1x-8a00ac1b1126c79eee197f4e5ae59689e942c881.tar.gz
vyos-1x-8a00ac1b1126c79eee197f4e5ae59689e942c881.zip
Merge pull request #2587 from jestabro/wireguard-T5413-migration-29-30
wireguard: T5413: fix missing check to migration script raising error
-rwxr-xr-xsrc/migration-scripts/interfaces/29-to-3011
1 files changed, 7 insertions, 4 deletions
diff --git a/src/migration-scripts/interfaces/29-to-30 b/src/migration-scripts/interfaces/29-to-30
index 97e1b329c..04e023e77 100755
--- a/src/migration-scripts/interfaces/29-to-30
+++ b/src/migration-scripts/interfaces/29-to-30
@@ -35,16 +35,19 @@ if __name__ == '__main__':
# Nothing to do
sys.exit(0)
for interface in config.list_nodes(base):
+ if not config.exists(base + [interface, 'private-key']):
+ continue
private_key = config.return_value(base + [interface, 'private-key'])
interface_base = base + [interface]
if config.exists(interface_base + ['peer']):
for peer in config.list_nodes(interface_base + ['peer']):
peer_base = interface_base + ['peer', peer]
+ if not config.exists(peer_base + ['public-key']):
+ continue
peer_public_key = config.return_value(peer_base + ['public-key'])
- if config.exists(peer_base + ['public-key']):
- if not config.exists(peer_base + ['disable']) \
- and is_wireguard_key_pair(private_key, peer_public_key):
- config.set(peer_base + ['disable'])
+ if not config.exists(peer_base + ['disable']) \
+ and is_wireguard_key_pair(private_key, peer_public_key):
+ config.set(peer_base + ['disable'])
try:
with open(file_name, 'w') as f: