|
|
86baa9 |
From fc9648e33668afa1c61d62ad9e3b033011dd12d4 Mon Sep 17 00:00:00 2001
|
|
|
86baa9 |
From: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
86baa9 |
Date: Fri, 26 Apr 2019 18:40:05 +0200
|
|
|
86baa9 |
Subject: [PATCH] ipactl restart: fix wrong logic when checking service list
|
|
|
86baa9 |
|
|
|
86baa9 |
ipactl is building a list of currently running services from
|
|
|
86baa9 |
the content of /var/run/ipa/services.list, and a list of expected services
|
|
|
86baa9 |
from the services configured in LDAP.
|
|
|
86baa9 |
|
|
|
86baa9 |
Because CA and KRA both correspond to the same pki-tomcatd service, the
|
|
|
86baa9 |
lists may contain duplicates. The code handling these duplicates is called
|
|
|
86baa9 |
at the wrong place, and may result in a wrong list of services to
|
|
|
86baa9 |
stop / restart / start.
|
|
|
86baa9 |
The fix removes the duplicates before returning the lists, hence making sure
|
|
|
86baa9 |
that there is no error when building the list of services to stop / restart
|
|
|
86baa9 |
/ start.
|
|
|
86baa9 |
|
|
|
86baa9 |
Fixes: https://pagure.io/freeipa/issue/7927
|
|
|
86baa9 |
Reviewed-By: Christian Heimes <cheimes@redhat.com>
|
|
|
86baa9 |
Reviewed-By: Christian Heimes <cheimes@redhat.com>
|
|
|
86baa9 |
---
|
|
|
86baa9 |
install/tools/ipactl | 10 ++--------
|
|
|
86baa9 |
1 file changed, 2 insertions(+), 8 deletions(-)
|
|
|
86baa9 |
|
|
|
86baa9 |
diff --git a/install/tools/ipactl b/install/tools/ipactl
|
|
|
86baa9 |
index f40ea5a6df74f04ec7e6e8959d731553651a81d3..5d858b8f9dd2a213a29c50cd2c9778b57fee9e46 100755
|
|
|
86baa9 |
--- a/install/tools/ipactl
|
|
|
86baa9 |
+++ b/install/tools/ipactl
|
|
|
86baa9 |
@@ -237,7 +237,7 @@ def get_config(dirsrv):
|
|
|
86baa9 |
for order, svc in sorted(svc_list):
|
|
|
86baa9 |
if svc in service.SERVICE_LIST:
|
|
|
86baa9 |
ordered_list.append(service.SERVICE_LIST[svc].systemd_name)
|
|
|
86baa9 |
- return ordered_list
|
|
|
86baa9 |
+ return deduplicate(ordered_list)
|
|
|
86baa9 |
|
|
|
86baa9 |
def get_config_from_file():
|
|
|
86baa9 |
|
|
|
86baa9 |
@@ -263,7 +263,7 @@ def get_config_from_file():
|
|
|
86baa9 |
if svc in svc_list:
|
|
|
86baa9 |
ordered_list.append(svc)
|
|
|
86baa9 |
|
|
|
86baa9 |
- return ordered_list
|
|
|
86baa9 |
+ return deduplicate(ordered_list)
|
|
|
86baa9 |
|
|
|
86baa9 |
|
|
|
86baa9 |
def stop_services(svc_list):
|
|
|
86baa9 |
@@ -325,7 +325,6 @@ def ipa_start(options):
|
|
|
86baa9 |
# no service to start
|
|
|
86baa9 |
return
|
|
|
86baa9 |
|
|
|
86baa9 |
- svc_list = deduplicate(svc_list)
|
|
|
86baa9 |
for svc in svc_list:
|
|
|
86baa9 |
svchandle = services.service(svc, api=api)
|
|
|
86baa9 |
try:
|
|
|
86baa9 |
@@ -365,7 +364,6 @@ def ipa_stop(options):
|
|
|
86baa9 |
finally:
|
|
|
86baa9 |
raise IpactlError()
|
|
|
86baa9 |
|
|
|
86baa9 |
- svc_list = deduplicate(svc_list)
|
|
|
86baa9 |
for svc in reversed(svc_list):
|
|
|
86baa9 |
svchandle = services.service(svc, api=api)
|
|
|
86baa9 |
try:
|
|
|
86baa9 |
@@ -452,7 +450,6 @@ def ipa_restart(options):
|
|
|
86baa9 |
|
|
|
86baa9 |
if len(old_svc_list) != 0:
|
|
|
86baa9 |
# we need to definitely stop some services
|
|
|
86baa9 |
- old_svc_list = deduplicate(old_svc_list)
|
|
|
86baa9 |
for svc in reversed(old_svc_list):
|
|
|
86baa9 |
svchandle = services.service(svc, api=api)
|
|
|
86baa9 |
try:
|
|
|
86baa9 |
@@ -477,7 +474,6 @@ def ipa_restart(options):
|
|
|
86baa9 |
|
|
|
86baa9 |
if len(svc_list) != 0:
|
|
|
86baa9 |
# there are services to restart
|
|
|
86baa9 |
- svc_list = deduplicate(svc_list)
|
|
|
86baa9 |
for svc in svc_list:
|
|
|
86baa9 |
svchandle = services.service(svc, api=api)
|
|
|
86baa9 |
try:
|
|
|
86baa9 |
@@ -500,7 +496,6 @@ def ipa_restart(options):
|
|
|
86baa9 |
|
|
|
86baa9 |
if len(new_svc_list) != 0:
|
|
|
86baa9 |
# we still need to start some services
|
|
|
86baa9 |
- new_svc_list = deduplicate(new_svc_list)
|
|
|
86baa9 |
for svc in new_svc_list:
|
|
|
86baa9 |
svchandle = services.service(svc, api=api)
|
|
|
86baa9 |
try:
|
|
|
86baa9 |
@@ -552,7 +547,6 @@ def ipa_status(options):
|
|
|
86baa9 |
if len(svc_list) == 0:
|
|
|
86baa9 |
return
|
|
|
86baa9 |
|
|
|
86baa9 |
- svc_list = deduplicate(svc_list)
|
|
|
86baa9 |
for svc in svc_list:
|
|
|
86baa9 |
svchandle = services.service(svc, api=api)
|
|
|
86baa9 |
try:
|
|
|
86baa9 |
--
|
|
|
86baa9 |
2.20.1
|
|
|
86baa9 |
|