URL: https://github.com/freeipa/freeipa/pull/665
Author: fidencio
 Title: #665: Allow erasing ipaDomainResolutionOrder attribute
Action: opened

PR body:
"""
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 doing calling delattr or
setting its value to an empty string.

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

Signed-off-by: Fabiano FidĂȘncio <fiden...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/665/head:pr665
git checkout pr665
From afa6e8342bcfedf09cd3e7e6917243b3512d3cfb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fiden...@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 doing calling delattr or
setting its value to an empty string.

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

Signed-off-by: Fabiano FidĂȘncio <fiden...@redhat.com>
---
 ipaserver/plugins/config.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ipaserver/plugins/config.py b/ipaserver/plugins/config.py
index 232c881..7167baa 100644
--- a/ipaserver/plugins/config.py
+++ b/ipaserver/plugins/config.py
@@ -359,6 +359,11 @@ def validate_domain_resolution_order(self, entry_attrs):
 
         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:
@@ -367,6 +372,7 @@ def validate_domain_resolution_order(self, entry_attrs):
         submitted_domains = domain_resolution_order.split(
                 DOMAIN_RESOLUTION_ORDER_SEPARATOR)
 
+
         known_domains = self.gather_trusted_domains()
 
         # add FreeIPA domain to the list of domains. This one is always enabled
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to