pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0054-Allow-erasing-ipaDomainResolutionOrder-attribute.patch

483b06
From 5b9fe9df34d0eff697adefa171d35a57e561c17e Mon Sep 17 00:00:00 2001
483b06
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
483b06
Date: Tue, 28 Mar 2017 16:15:21 +0200
483b06
Subject: [PATCH] Allow erasing ipaDomainResolutionOrder attribute
483b06
MIME-Version: 1.0
483b06
Content-Type: text/plain; charset=UTF-8
483b06
Content-Transfer-Encoding: 8bit
483b06
483b06
Currently when trying to erase the ipaDomainResolutionOrder attribute we
483b06
hit an internal error as the split() method is called on a None object.
483b06
483b06
By returning early in case of empty string we now allow removing the
483b06
ipaDomainResolutionOrder attribute by both calling delattr or setting
483b06
its value to an empty string.
483b06
483b06
https://pagure.io/freeipa/issue/6825
483b06
483b06
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
483b06
Reviewed-By: Martin Basti <mbasti@redhat.com>
483b06
---
483b06
 ipaserver/plugins/config.py | 5 +++++
483b06
 1 file changed, 5 insertions(+)
483b06
483b06
diff --git a/ipaserver/plugins/config.py b/ipaserver/plugins/config.py
483b06
index 232c88121fd2c938f77a1e76e1d7c9f0ad8e7550..b50e7a4691bd76bfaf7c332cd89b0f1bf55bac46 100644
483b06
--- a/ipaserver/plugins/config.py
483b06
+++ b/ipaserver/plugins/config.py
483b06
@@ -359,6 +359,11 @@ class config(LDAPObject):
483b06
 
483b06
         domain_resolution_order = entry_attrs[attr_name]
483b06
 
483b06
+        # setting up an empty string means that the previous configuration has
483b06
+        # to be cleaned up/removed. So, do nothing and let it pass
483b06
+        if not domain_resolution_order:
483b06
+            return
483b06
+
483b06
         # empty resolution order is signalized by single separator, do nothing
483b06
         # and let it pass
483b06
         if domain_resolution_order == DOMAIN_RESOLUTION_ORDER_SEPARATOR:
483b06
-- 
483b06
2.12.2
483b06