Skip to content
Snippets Groups Projects
Commit eb8606f1 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Add possibility to set gateway in --networkmanager mode

parent fa952f19
No related branches found
No related tags found
No related merge requests found
...@@ -259,6 +259,13 @@ def configure_networking(connection, interface, settings=None): ...@@ -259,6 +259,13 @@ def configure_networking(connection, interface, settings=None):
update['ipv4', 'never-default'] = None update['ipv4', 'never-default'] = None
update['ipv6', 'never-default'] = None update['ipv6', 'never-default'] = None
pass pass
ipv4gw = list(filter(None, [ ip.gateway[0] for ip in interface._ip_]))
if ipv4gw:
if len(ipv4gw) != 1:
raise Exception('Only one gateway allowed')
update['ipv4', 'gateway'] = ipv4gw[0]
update['ipv4', 'never-default'] = None
pass
ipv6gw = list(filter(None, [ ip.gateway[0] for ip in interface._ipv6_])) ipv6gw = list(filter(None, [ ip.gateway[0] for ip in interface._ipv6_]))
if ipv6gw: if ipv6gw:
if len(ipv6gw) != 1: if len(ipv6gw) != 1:
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment