From d787f8b0a31333e9e06a7cf5f24da6e52d1f945b Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Thu, 1 Apr 2021 16:25:24 +0200 Subject: [PATCH] bundles/systemd-networkd: rework routes --- .../systemd-networkd/files/template-iface-nodhcp.network | 6 ++++-- nodes/home/downloadhelper.py | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bundles/systemd-networkd/files/template-iface-nodhcp.network b/bundles/systemd-networkd/files/template-iface-nodhcp.network index cf36211..7ce3c60 100644 --- a/bundles/systemd-networkd/files/template-iface-nodhcp.network +++ b/bundles/systemd-networkd/files/template-iface-nodhcp.network @@ -16,10 +16,12 @@ Name=${interface} Address=${ip}/${prefix} % endfor -% for route in config.get('routes', {}): +% for route, rconfig in sorted(config.get('routes', {}).items()): [Route] +% if 'via' in rconfig: Gateway=${route['via']} -Destination=${route['to']} +% endif +Destination=${route} GatewayOnlink=yes % endfor diff --git a/nodes/home/downloadhelper.py b/nodes/home/downloadhelper.py index cf8d810..b9804a9 100644 --- a/nodes/home/downloadhelper.py +++ b/nodes/home/downloadhelper.py @@ -17,13 +17,12 @@ nodes['home.downloadhelper'] = { 'ips': { '172.19.138.27/24', }, - 'routes': [ - { - # VPN - 'to': '172.19.136.0/22', + 'routes': { + # VPN + '172.19.136.0/22': { 'via': '172.19.138.1', }, - ], + }, }, }, 'backups': {