Don't include addresses in network update (#3628)

* Don't include addresses in network update

* revert format fix
This commit is contained in:
Mike Degatano 2022-05-09 16:44:17 -04:00 committed by GitHub
parent aa8910280d
commit 567806cd14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -122,7 +122,12 @@ class NetworkSetting(DBusInterfaceProxy):
)
_merge_settings_attribute(new_settings, settings, CONF_ATTR_VLAN)
_merge_settings_attribute(new_settings, settings, CONF_ATTR_IPV4)
if "addresses" in new_settings[CONF_ATTR_IPV4]:
del new_settings[CONF_ATTR_IPV4]["addresses"]
_merge_settings_attribute(new_settings, settings, CONF_ATTR_IPV6)
if "addresses" in new_settings[CONF_ATTR_IPV6]:
del new_settings[CONF_ATTR_IPV6]["addresses"]
return await self.dbus.Settings.Connection.Update(("a{sa{sv}}", new_settings))

View File

@ -97,6 +97,7 @@ async def mock_call_dbus_get_settings_signature(
"s", "192.168.2.148"
)
assert settings["ipv4"]["address-data"].value[0]["prefix"] == Variant("u", 24)
assert "addresses" not in settings["ipv4"]
assert len(settings["ipv4"]["route-data"].value) == 1
assert settings["ipv4"]["route-data"].value[0]["dest"] == Variant(
"s", "192.168.122.0"
@ -112,6 +113,7 @@ async def mock_call_dbus_get_settings_signature(
assert "ipv6" in settings
assert settings["ipv6"]["method"] == Variant("s", "auto")
assert settings["ipv6"]["addr-gen-mode"] == Variant("i", 0)
assert "addresses" not in settings["ipv6"]
assert "proxy" in settings