Blob Blame History Raw
From 5b9fe9df34d0eff697adefa171d35a57e561c17e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Tue, 28 Mar 2017 16:15:21 +0200
Subject: [PATCH] Allow erasing ipaDomainResolutionOrder attribute
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently when trying to erase the ipaDomainResolutionOrder attribute we
hit an internal error as the split() method is called on a None object.

By returning early in case of empty string we now allow removing the
ipaDomainResolutionOrder attribute by both calling delattr or setting
its value to an empty string.

https://pagure.io/freeipa/issue/6825

Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
Reviewed-By: Martin Basti <mbasti@redhat.com>
---
 ipaserver/plugins/config.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ipaserver/plugins/config.py b/ipaserver/plugins/config.py
index 232c88121fd2c938f77a1e76e1d7c9f0ad8e7550..b50e7a4691bd76bfaf7c332cd89b0f1bf55bac46 100644
--- a/ipaserver/plugins/config.py
+++ b/ipaserver/plugins/config.py
@@ -359,6 +359,11 @@ class config(LDAPObject):
 
         domain_resolution_order = entry_attrs[attr_name]
 
+        # setting up an empty string means that the previous configuration has
+        # to be cleaned up/removed. So, do nothing and let it pass
+        if not domain_resolution_order:
+            return
+
         # empty resolution order is signalized by single separator, do nothing
         # and let it pass
         if domain_resolution_order == DOMAIN_RESOLUTION_ORDER_SEPARATOR:
-- 
2.12.2