|
|
86baa9 |
From 3c2237e481fdb2241494bd285931803335ed44dd Mon Sep 17 00:00:00 2001
|
|
|
86baa9 |
From: Oleg Kozlov <xxblx@posteo.org>
|
|
|
86baa9 |
Date: Fri, 29 Mar 2019 14:35:02 +0100
|
|
|
86baa9 |
Subject: [PATCH] Show a notification that sssd needs restarting after
|
|
|
86baa9 |
idrange-mod
|
|
|
86baa9 |
|
|
|
86baa9 |
If the `ipa idrange-mod` command has been used show a notification that sssd.service needs restarting. It's needed for applying changes. E.g. after setup AD trust with a domain with more than 200000 objects (the highest RID > idm's default value, 200000) users with RIDs > 200000 are not able to login, the size needs to be increased via idrange-mod, but it makes an effect only after sssd restarting.
|
|
|
86baa9 |
|
|
|
86baa9 |
Implementation:
|
|
|
86baa9 |
Notification was implemented via passing `ipalib.messages.ServiceRestartRequired` to `add_message` method in `ipaserver.plugins.idrange.idrange_mod.post_callback`.
|
|
|
86baa9 |
|
|
|
86baa9 |
Tests:
|
|
|
86baa9 |
Added `messages` with sssd restart required (`ipalib.messages.ServiceRestartRequired`) to cases with idrange_mod where output is expected in `ipatests.test_xmlrpc.test_range_plugin.test_range'.
|
|
|
86baa9 |
|
|
|
86baa9 |
Fixes: https://pagure.io/freeipa/issue/7708
|
|
|
86baa9 |
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
86baa9 |
Reviewed-By: Christian Heimes <cheimes@redhat.com>
|
|
|
86baa9 |
---
|
|
|
86baa9 |
ipaplatform/base/services.py | 3 ++-
|
|
|
86baa9 |
ipaserver/plugins/idrange.py | 11 ++++++++++-
|
|
|
86baa9 |
ipatests/test_xmlrpc/test_range_plugin.py | 17 ++++++++++++++++-
|
|
|
86baa9 |
3 files changed, 28 insertions(+), 3 deletions(-)
|
|
|
86baa9 |
|
|
|
86baa9 |
diff --git a/ipaplatform/base/services.py b/ipaplatform/base/services.py
|
|
|
86baa9 |
index 9fd2a8532837c631945fa837be03c80fa42128bf..b037718f22fc36c4a01b3b0962b3f9e7a69f4b7e 100644
|
|
|
86baa9 |
--- a/ipaplatform/base/services.py
|
|
|
86baa9 |
+++ b/ipaplatform/base/services.py
|
|
|
86baa9 |
@@ -53,7 +53,8 @@ wellknownservices = ['certmonger', 'dirsrv', 'httpd', 'ipa', 'krb5kdc',
|
|
|
86baa9 |
'messagebus', 'nslcd', 'nscd', 'ntpd', 'portmap',
|
|
|
86baa9 |
'rpcbind', 'kadmin', 'sshd', 'autofs', 'rpcgssd',
|
|
|
86baa9 |
'rpcidmapd', 'pki_tomcatd', 'chronyd', 'domainname',
|
|
|
86baa9 |
- 'named', 'ods_enforcerd', 'ods_signerd', 'gssproxy']
|
|
|
86baa9 |
+ 'named', 'ods_enforcerd', 'ods_signerd', 'gssproxy',
|
|
|
86baa9 |
+ 'sssd']
|
|
|
86baa9 |
|
|
|
86baa9 |
# The common ports for these services. This is used to wait for the
|
|
|
86baa9 |
# service to become available.
|
|
|
86baa9 |
diff --git a/ipaserver/plugins/idrange.py b/ipaserver/plugins/idrange.py
|
|
|
86baa9 |
index ea3d1ff5662800957cde99934e9d2577e6b13ea6..364f128de4a04f484bde0def3c782e1a48be1daa 100644
|
|
|
86baa9 |
--- a/ipaserver/plugins/idrange.py
|
|
|
86baa9 |
+++ b/ipaserver/plugins/idrange.py
|
|
|
86baa9 |
@@ -17,13 +17,16 @@
|
|
|
86baa9 |
# You should have received a copy of the GNU General Public License
|
|
|
86baa9 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
86baa9 |
|
|
|
86baa9 |
+from __future__ import absolute_import
|
|
|
86baa9 |
+
|
|
|
86baa9 |
import six
|
|
|
86baa9 |
|
|
|
86baa9 |
from ipalib.plugable import Registry
|
|
|
86baa9 |
from .baseldap import (LDAPObject, LDAPCreate, LDAPDelete,
|
|
|
86baa9 |
LDAPRetrieve, LDAPSearch, LDAPUpdate)
|
|
|
86baa9 |
-from ipalib import api, Int, Str, StrEnum, _, ngettext
|
|
|
86baa9 |
+from ipalib import api, Int, Str, StrEnum, _, ngettext, messages
|
|
|
86baa9 |
from ipalib import errors
|
|
|
86baa9 |
+from ipaplatform import services
|
|
|
86baa9 |
from ipapython.dn import DN
|
|
|
86baa9 |
|
|
|
86baa9 |
if six.PY3:
|
|
|
86baa9 |
@@ -768,4 +771,10 @@ class idrange_mod(LDAPUpdate):
|
|
|
86baa9 |
assert isinstance(dn, DN)
|
|
|
86baa9 |
self.obj.handle_ipabaserid(entry_attrs, options)
|
|
|
86baa9 |
self.obj.handle_iparangetype(entry_attrs, options)
|
|
|
86baa9 |
+ self.add_message(
|
|
|
86baa9 |
+ messages.ServiceRestartRequired(
|
|
|
86baa9 |
+ service=services.knownservices['sssd'].systemd_name,
|
|
|
86baa9 |
+ server=keys[0]
|
|
|
86baa9 |
+ )
|
|
|
86baa9 |
+ )
|
|
|
86baa9 |
return dn
|
|
|
86baa9 |
diff --git a/ipatests/test_xmlrpc/test_range_plugin.py b/ipatests/test_xmlrpc/test_range_plugin.py
|
|
|
86baa9 |
index 0a8f66b62dac9ea2e4692f0f64b1c8fbc9272fd2..2adc57ed5f5d23fe5f457ab3a5e23462f24a62fe 100644
|
|
|
86baa9 |
--- a/ipatests/test_xmlrpc/test_range_plugin.py
|
|
|
86baa9 |
+++ b/ipatests/test_xmlrpc/test_range_plugin.py
|
|
|
86baa9 |
@@ -21,9 +21,12 @@
|
|
|
86baa9 |
Test the `ipaserver/plugins/idrange.py` module, and XML-RPC in general.
|
|
|
86baa9 |
"""
|
|
|
86baa9 |
|
|
|
86baa9 |
+from __future__ import absolute_import
|
|
|
86baa9 |
+
|
|
|
86baa9 |
import six
|
|
|
86baa9 |
|
|
|
86baa9 |
-from ipalib import api, errors
|
|
|
86baa9 |
+from ipalib import api, errors, messages
|
|
|
86baa9 |
+from ipaplatform import services
|
|
|
86baa9 |
from ipatests.test_xmlrpc.xmlrpc_test import Declarative, fuzzy_uuid
|
|
|
86baa9 |
from ipatests.test_xmlrpc import objectclasses
|
|
|
86baa9 |
from ipatests.util import MockLDAP
|
|
|
86baa9 |
@@ -786,6 +789,12 @@ class test_range(Declarative):
|
|
|
86baa9 |
command=('idrange_mod', [domain3range2],
|
|
|
86baa9 |
dict(ipabaseid=domain3range1_base_id)),
|
|
|
86baa9 |
expected=dict(
|
|
|
86baa9 |
+ messages=(
|
|
|
86baa9 |
+ messages.ServiceRestartRequired(
|
|
|
86baa9 |
+ service=services.knownservices['sssd'].systemd_name,
|
|
|
86baa9 |
+ server=domain3range2
|
|
|
86baa9 |
+ ).to_dict(),
|
|
|
86baa9 |
+ ),
|
|
|
86baa9 |
result=dict(
|
|
|
86baa9 |
cn=[domain3range2],
|
|
|
86baa9 |
ipabaseid=[unicode(domain3range1_base_id)],
|
|
|
86baa9 |
@@ -851,6 +860,12 @@ class test_range(Declarative):
|
|
|
86baa9 |
command=('idrange_mod', [domain2range1],
|
|
|
86baa9 |
dict(ipabaserid=domain5range1_base_rid)),
|
|
|
86baa9 |
expected=dict(
|
|
|
86baa9 |
+ messages=(
|
|
|
86baa9 |
+ messages.ServiceRestartRequired(
|
|
|
86baa9 |
+ service=services.knownservices['sssd'].systemd_name,
|
|
|
86baa9 |
+ server=domain2range1
|
|
|
86baa9 |
+ ).to_dict(),
|
|
|
86baa9 |
+ ),
|
|
|
86baa9 |
result=dict(
|
|
|
86baa9 |
cn=[domain2range1],
|
|
|
86baa9 |
ipabaseid=[unicode(domain2range1_base_id)],
|
|
|
86baa9 |
--
|
|
|
86baa9 |
2.20.1
|
|
|
86baa9 |
|