summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-12-07 19:53:53 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-12-07 22:36:07 -0600
commit237b71a89160f28e5c603bacf707b1c235f01026 (patch)
tree4dca1ff0ab81591c6049a575dd1228fe0cf829ec
parentee5c78e966d3b6e98e7b4f94acb4ef88094b5e54 (diff)
downloadvyos-1x-237b71a89160f28e5c603bacf707b1c235f01026.tar.gz
vyos-1x-237b71a89160f28e5c603bacf707b1c235f01026.zip
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: