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