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

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 e81f650ea4dbe262275a8b1a13f8a99368f03c45 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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ipaserver/plugins/config.py b/ipaserver/plugins/config.py
index 232c881..b50e7a4 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:
-- 
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