Blame SOURCES/0002-Config-plugin-return-EmptyModlist-when-no-change-is-applied_rhbz#2031825.patch

07426e
From b9c42fed9b6f60801f908c368d0d97a2a69f7bb2 Mon Sep 17 00:00:00 2001
07426e
From: Florence Blanc-Renaud <flo@redhat.com>
07426e
Date: Wed, 15 Dec 2021 10:47:02 +0100
07426e
Subject: [PATCH] Config plugin: return EmptyModlist when no change is applied
07426e
07426e
When ipa config-mod is called with the option --enable-sid,
07426e
the code needs to trap EmptyModlist exception (it is expected
07426e
that no LDAP attribute is modified by this operation).
07426e
The code had a flaw and was checking:
07426e
    'enable_sid' in options
07426e
instead of
07426e
    options['enable_sid']
07426e
07426e
"'enable_sid' in options" always returns true as this option
07426e
is a Flag with a default value, hence always present even if
07426e
not specified on the command line.
07426e
07426e
Fixes: https://pagure.io/freeipa/issue/9063
07426e
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
07426e
---
07426e
 ipaserver/plugins/config.py | 2 +-
07426e
 1 file changed, 1 insertion(+), 1 deletion(-)
07426e
07426e
diff --git a/ipaserver/plugins/config.py b/ipaserver/plugins/config.py
07426e
index eae401fc3..24446beb0 100644
07426e
--- a/ipaserver/plugins/config.py
07426e
+++ b/ipaserver/plugins/config.py
07426e
@@ -707,7 +707,7 @@ class config_mod(LDAPUpdate):
07426e
         if (isinstance(exc, errors.EmptyModlist) and
07426e
                 call_func.__name__ == 'update_entry' and
07426e
                 ('ca_renewal_master_server' in options or
07426e
-                 'enable_sid' in options)):
07426e
+                 options['enable_sid'])):
07426e
             return
07426e
 
07426e
         super(config_mod, self).exc_callback(
07426e
-- 
07426e
2.34.1
07426e
07426e
From cd735099e86304294217147ed578ac902fcf3dd3 Mon Sep 17 00:00:00 2001
07426e
From: Florence Blanc-Renaud <flo@redhat.com>
07426e
Date: Wed, 15 Dec 2021 10:51:05 +0100
07426e
Subject: [PATCH] config plugin: add a test ensuring EmptyModlist is returned
07426e
07426e
Add a test to test_config_plugin, that calls ipa config-mod
07426e
with the same value as already present in LDAP.
07426e
The call must return EmptyModlist.
07426e
07426e
Related: https://pagure.io/freeipa/issue/9063
07426e
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
07426e
---
07426e
 ipatests/test_xmlrpc/test_config_plugin.py | 9 +++++++++
07426e
 1 file changed, 9 insertions(+)
07426e
07426e
diff --git a/ipatests/test_xmlrpc/test_config_plugin.py b/ipatests/test_xmlrpc/test_config_plugin.py
07426e
index e981bb4a0..a8ec9f0e5 100644
07426e
--- a/ipatests/test_xmlrpc/test_config_plugin.py
07426e
+++ b/ipatests/test_xmlrpc/test_config_plugin.py
07426e
@@ -312,4 +312,13 @@ class test_config(Declarative):
07426e
                 'value': None,
07426e
             },
07426e
         ),
07426e
+        dict(
07426e
+            desc='Set the value to the already set value, no modifications',
07426e
+            command=(
07426e
+                'config_mod', [], {
07426e
+                    'ipasearchrecordslimit': u'100',
07426e
+                },
07426e
+            ),
07426e
+            expected=errors.EmptyModlist(),
07426e
+        ),
07426e
     ]
07426e
-- 
07426e
2.34.1
07426e