483b06
From 1f9d9de5dd0e5935bb71060d867b46f675977163 Mon Sep 17 00:00:00 2001
483b06
From: Florence Blanc-Renaud <flo@redhat.com>
483b06
Date: Tue, 28 Mar 2017 16:02:45 +0200
483b06
Subject: [PATCH] idrange-add: properly handle empty --dom-name option
483b06
483b06
When idrange-add is called with --dom-name=, the CLI exits with
483b06
ipa: ERROR: an internal error has occurred
483b06
This happens because the code checks if the option is provided but does not
483b06
check if the value is None.
483b06
483b06
We need to handle empty dom-name as if the option was not specified.
483b06
483b06
https://pagure.io/freeipa/issue/6404
483b06
483b06
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
483b06
---
483b06
 ipaserver/plugins/idrange.py | 2 +-
483b06
 1 file changed, 1 insertion(+), 1 deletion(-)
483b06
483b06
diff --git a/ipaserver/plugins/idrange.py b/ipaserver/plugins/idrange.py
483b06
index 5b88a6b0fd91271eaeb19c8315e23299a13ff7e4..c8ea95af801a86dd0180497964ddbd1b2741f279 100644
483b06
--- a/ipaserver/plugins/idrange.py
483b06
+++ b/ipaserver/plugins/idrange.py
483b06
@@ -411,7 +411,7 @@ class idrange_add(LDAPCreate):
483b06
 
483b06
         # This needs to stay in options since there is no
483b06
         # ipanttrusteddomainname attribute in LDAP
483b06
-        if 'ipanttrusteddomainname' in options:
483b06
+        if options.get('ipanttrusteddomainname'):
483b06
             if is_set('ipanttrusteddomainsid'):
483b06
                 raise errors.ValidationError(name='ID Range setup',
483b06
                     error=_('Options dom-sid and dom-name '
483b06
-- 
483b06
2.9.3
483b06