mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
nm: Fix the incorrect change indication for dns option
When applying with `dhcp4: "no"` or `auto6: "no"`, we get incorrect change indication even when network connection was not changed. The root cause is the `NM.SettingIPConfig.clear_dns_options(True)` will create an empty list which will be discard by ifcfg plugin. The follow up `NM.Connection.compare()` will show configuration changed as dns option entry missing. Fixed by remove dns option completely before appending. Signed-off-by: Gris Ge <fge@redhat.com>
This commit is contained in:
parent
f538865c68
commit
245ff58e25
2 changed files with 45 additions and 16 deletions
|
|
@ -1044,7 +1044,11 @@ class NMUtil:
|
|||
s_ip4.add_dns(nameserver["address"])
|
||||
for search_domain in ip["dns_search"]:
|
||||
s_ip4.add_dns_search(search_domain)
|
||||
s_ip4.clear_dns_options(True)
|
||||
# NetworkManager ifcfg plguin will discard empty dns option which
|
||||
# cause follow up NM.Connection.compare() raise false alarm
|
||||
# Use False here to ask NetworkManager remove dns option completely instead
|
||||
# of keeping an empty list
|
||||
s_ip4.clear_dns_options(False)
|
||||
for option in ip["dns_options"]:
|
||||
s_ip4.add_dns_option(option)
|
||||
|
||||
|
|
@ -1086,7 +1090,11 @@ class NMUtil:
|
|||
s_ip6.add_dns(nameserver["address"])
|
||||
for search_domain in ip["dns_search"]:
|
||||
s_ip6.add_dns_search(search_domain)
|
||||
s_ip6.clear_dns_options(True)
|
||||
# NetworkManager ifcfg plguin will discard empty dns option which
|
||||
# cause follow up NM.Connection.compare() raise false alarm
|
||||
# Use False here to ask NetworkManager remove dns option completely instead
|
||||
# of keeping an empty list
|
||||
s_ip6.clear_dns_options(False)
|
||||
for option in ip["dns_options"]:
|
||||
s_ip6.add_dns_option(option)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue