Commit a4f8bb11 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Some more networkmanager cleanups

parent 0cfe651e
......@@ -208,10 +208,7 @@ def configure_networking(connection, interface):
update['ipv6', 'dns'] = network.dns(interface._ipv6_)
update['ipv6', 'dns-search'] = network.dns_search(interface._ipv6_)
update['ipv6', 'method'] = ('disabled','manual')[len(ipv6a) > 0]
#if interface.bridge[0] or interface.defroute[0] == 'no':
# # Bridges seems to be unable to accept gateways...
if interface.defroute[0] == 'no':
# Bridges seems to be unable to accept gateways...
update['ipv4', 'gateway'] = None
update['ipv6', 'gateway'] = None
update['ipv4', 'never-default'] = True
......@@ -230,10 +227,20 @@ def configure_networking(connection, interface):
if interface.bridge[0]:
# (stp == 'no') -> False, else None
update['bridge', 'stp'] = (None,False)[interface.stp[0] == 'no']
before = connection.GetSettings()
pass
def cleanup_deprecated(settings):
for family in [ 'ipv4', 'ipv6' ]:
if ('address-data' in settings[family] and
'addresses' in settings[family]):
del settings[family]['addresses']
pass
pass
return settings
before = cleanup_deprecated(connection.GetSettings())
after = update_settings(before, update)
if before != after:
x = connection.Update(after)
connection.Update(after)
print(before['connection']['id'])
from pprint import pprint
pprint(before)
pprint(after)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment