From e5a011ce5d20773705b949289a0fba6b45300a79 Mon Sep 17 00:00:00 2001 From: kshithijiyer Date: Tue, 7 Apr 2020 00:47:17 +0530 Subject: [Libfix] Change daemon_reload() to support newer platforms Problem: Currently the code supports both service and systemctl commands but it fails on the latest platforms with the below error on the latest platforms: ``` service glusterd reload Redirecting to /bin/systemctl reload glusterd.service Failed to reload glusterd.service: Job type reload is not applicable for unit glusterd.service. ``` This is because the latest platforms uses systemctl instead of service to reload the daemon processes: ``` systemctl daemon-reload ``` Solution: The present code doesn't work properly as the check is specific to only one platform, hence it fails. The solution for this is to just check for older platforms and run service command. For all other platforms run systemctl command. Change-Id: I19b24652b96c4794553d3659eaf0301395929bca Signed-off-by: kshithijiyer --- glustolibs-misc/glustolibs/misc/misc_libs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'glustolibs-misc/glustolibs/misc') diff --git a/glustolibs-misc/glustolibs/misc/misc_libs.py b/glustolibs-misc/glustolibs/misc/misc_libs.py index 3ec4452d4..fea86d125 100755 --- a/glustolibs-misc/glustolibs/misc/misc_libs.py +++ b/glustolibs-misc/glustolibs/misc/misc_libs.py @@ -21,7 +21,7 @@ import sys import time from glusto.core import Glusto as g -from glustolibs.gluster.lib_utils import is_rhel7 +from glustolibs.gluster.lib_utils import is_rhel6 def create_dirs(list_of_nodes, list_of_dir_paths): @@ -572,14 +572,14 @@ def daemon_reload(node): bool: True, On successful daemon reload False, Otherwise """ - if is_rhel7([node]): - cmd = "systemctl daemon-reload" + if is_rhel6([node]): + cmd = 'service glusterd reload' ret, _, _ = g.run(node, cmd) if ret != 0: g.log.error("Failed to reload the daemon") return False else: - cmd = 'service glusterd reload' + cmd = "systemctl daemon-reload" ret, _, _ = g.run(node, cmd) if ret != 0: g.log.error("Failed to reload the daemon") -- cgit