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

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