From fef532d7d6e8932b1b91eb0fc811335d55a79257 Mon Sep 17 00:00:00 2001 From: Gonéri Le Bouder Date: Tue, 4 Jan 2022 15:04:09 -0500 Subject: bsd/resolv.d/ avoid duplicated entries (#1163) Ensure we don't add duplicated nameserver or searchdomains. This can happen on OpenBSD because of dhcpleased. --- cloudinit/net/bsd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cloudinit/net') diff --git a/cloudinit/net/bsd.py b/cloudinit/net/bsd.py index dc322582..ff5c7413 100644 --- a/cloudinit/net/bsd.py +++ b/cloudinit/net/bsd.py @@ -138,14 +138,14 @@ class BSDRenderer(renderer.Renderer): resolvconf.parse() # Add some nameservers - for server in nameservers: + for server in set(nameservers): try: resolvconf.add_nameserver(server) except ValueError: util.logexc(LOG, "Failed to add nameserver %s", server) # And add any searchdomains. - for domain in searchdomains: + for domain in set(searchdomains): try: resolvconf.add_search_domain(domain) except ValueError: -- cgit v1.2.3