summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Kupka <dkupka@redhat.com>2015-08-26 15:10:16 +0200
committerPetr Vobornik <pvoborni@redhat.com>2015-08-26 17:43:03 +0200
commit21cdcbd9a6b6a82d39d40b91a64d4d9b4d7e4e7d (patch)
tree15948d7b9806de514ad4386bf03415913539bc96
parent9fc82bc66992eaa5daeed80e366e10986a8583d8 (diff)
downloadfreeipa-21cdcbd9a6b6a82d39d40b91a64d4d9b4d7e4e7d.tar.gz
freeipa-21cdcbd9a6b6a82d39d40b91a64d4d9b4d7e4e7d.tar.xz
freeipa-21cdcbd9a6b6a82d39d40b91a64d4d9b4d7e4e7d.zip
ipactl: Do not start/stop/restart single service multiple times
In case multiple services are provided by single system daemon it is not needed to start/stop/restart it mutiple time. https://fedorahosted.org/freeipa/ticket/5248 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
-rwxr-xr-xinstall/tools/ipactl17
1 files changed, 16 insertions, 1 deletions
diff --git a/install/tools/ipactl b/install/tools/ipactl
index 52dfe67dd..acad7ff37 100755
--- a/install/tools/ipactl
+++ b/install/tools/ipactl
@@ -45,6 +45,16 @@ def check_IPA_configuration():
raise IpactlError("IPA is not configured " +
"(see man pages of ipa-server-install for help)", 6)
+def deduplicate(lst):
+ new_lst = []
+ s = set(lst)
+ for i in lst:
+ if i in s:
+ s.remove(i)
+ new_lst.append(i)
+
+ return new_lst
+
def is_dirsrv_debugging_enabled():
"""
Check the 389-ds instance to see if debugging is enabled.
@@ -283,6 +293,7 @@ def ipa_start(options):
# no service to start
return
+ svc_list = deduplicate(svc_list)
for svc in svc_list:
svchandle = services.service(svc)
try:
@@ -321,6 +332,7 @@ def ipa_stop(options):
finally:
raise IpactlError()
+ svc_list = deduplicate(svc_list)
for svc in reversed(svc_list):
svchandle = services.service(svc)
try:
@@ -398,6 +410,7 @@ def ipa_restart(options):
if len(old_svc_list) != 0:
# we need to definitely stop some services
+ old_svc_list = deduplicate(old_svc_list)
for svc in reversed(old_svc_list):
svchandle = services.service(svc)
try:
@@ -422,7 +435,7 @@ def ipa_restart(options):
if len(svc_list) != 0:
# there are services to restart
-
+ svc_list = deduplicate(svc_list)
for svc in svc_list:
svchandle = services.service(svc)
try:
@@ -444,6 +457,7 @@ def ipa_restart(options):
if len(new_svc_list) != 0:
# we still need to start some services
+ new_svc_list = deduplicate(new_svc_list)
for svc in new_svc_list:
svchandle = services.service(svc)
try:
@@ -494,6 +508,7 @@ def ipa_status(options):
if len(svc_list) == 0:
return
+ svc_list = deduplicate(svc_list)
for svc in svc_list:
svchandle = services.service(svc)
try: