summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-12-08 09:43:38 +0100
committerGitHub <noreply@github.com>2023-12-08 09:43:38 +0100
commit0545c81ee085aaf6efa5c1815e3fe89f0f1a2f46 (patch)
tree16d55047df18edb456d5b1bb8665ae32812fbd69
parentd79b4b143c9d167a8210976b807b6eb996ace6d3 (diff)
parente14c6ca24f2eda229ca4c83190fd02ac90cdabd9 (diff)
downloadvyos-1x-0545c81ee085aaf6efa5c1815e3fe89f0f1a2f46.tar.gz
vyos-1x-0545c81ee085aaf6efa5c1815e3fe89f0f1a2f46.zip
Merge pull request #2588 from vyos/mergify/bp/sagitta/pr-2587
wireguard: T5413: fix missing check to migration script raising error (backport #2587)
-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: