Blob Blame History Raw
From 3333cb8bfa77fb208bb4f6f62dce770aa235bc2b Mon Sep 17 00:00:00 2001
From: Fernando Fernandez Mancera <ffmancera@riseup.net>
Date: Mon, 6 Jul 2020 13:45:19 +0200
Subject: [PATCH] dns: fix remove dns config

This patch is fixing the support of removing the dns config.

Ref: https://bugzilla.redhat.com/1850698

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
---
 libnmstate/dns.py             | 8 +++++---
 tests/integration/dns_test.py | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libnmstate/dns.py b/libnmstate/dns.py
index 1ec0d81..e41220f 100644
--- a/libnmstate/dns.py
+++ b/libnmstate/dns.py
@@ -181,9 +181,11 @@ class DnsState:
 
     def verify(self, cur_dns_state):
         cur_dns = DnsState(des_dns_state=None, cur_dns_state=cur_dns_state,)
-        if self.config.get(DNS.SERVER) != cur_dns.config.get(
-            DNS.SERVER
-        ) or self.config.get(DNS.SEARCH) != cur_dns.config.get(DNS.SEARCH):
+        if self.config.get(DNS.SERVER, []) != cur_dns.config.get(
+            DNS.SERVER, []
+        ) or self.config.get(DNS.SEARCH, []) != cur_dns.config.get(
+            DNS.SEARCH, []
+        ):
             raise NmstateVerificationError(
                 format_desired_current_state_diff(
                     {DNS.KEY: self.config}, {DNS.KEY: cur_dns.config},
-- 
2.25.4