bb0ded
From b9c42fed9b6f60801f908c368d0d97a2a69f7bb2 Mon Sep 17 00:00:00 2001
bb0ded
From: Florence Blanc-Renaud <flo@redhat.com>
bb0ded
Date: Wed, 15 Dec 2021 10:47:02 +0100
bb0ded
Subject: [PATCH] Config plugin: return EmptyModlist when no change is applied
bb0ded
bb0ded
When ipa config-mod is called with the option --enable-sid,
bb0ded
the code needs to trap EmptyModlist exception (it is expected
bb0ded
that no LDAP attribute is modified by this operation).
bb0ded
The code had a flaw and was checking:
bb0ded
    'enable_sid' in options
bb0ded
instead of
bb0ded
    options['enable_sid']
bb0ded
bb0ded
"'enable_sid' in options" always returns true as this option
bb0ded
is a Flag with a default value, hence always present even if
bb0ded
not specified on the command line.
bb0ded
bb0ded
Fixes: https://pagure.io/freeipa/issue/9063
bb0ded
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
bb0ded
---
bb0ded
 ipaserver/plugins/config.py | 2 +-
bb0ded
 1 file changed, 1 insertion(+), 1 deletion(-)
bb0ded
bb0ded
diff --git a/ipaserver/plugins/config.py b/ipaserver/plugins/config.py
bb0ded
index eae401fc3f7a1b7628eb211db206ba4bc2b36754..24446beb0b03a1510a96316eae915780817db102 100644
bb0ded
--- a/ipaserver/plugins/config.py
bb0ded
+++ b/ipaserver/plugins/config.py
bb0ded
@@ -707,7 +707,7 @@ class config_mod(LDAPUpdate):
bb0ded
         if (isinstance(exc, errors.EmptyModlist) and
bb0ded
                 call_func.__name__ == 'update_entry' and
bb0ded
                 ('ca_renewal_master_server' in options or
bb0ded
-                 'enable_sid' in options)):
bb0ded
+                 options['enable_sid'])):
bb0ded
             return
bb0ded
 
bb0ded
         super(config_mod, self).exc_callback(
bb0ded
-- 
bb0ded
2.34.1
bb0ded