From cb3681d9f3992532c40d7ed7329a675dcd9d75d2 Mon Sep 17 00:00:00 2001 From: Bala Konda Reddy M Date: Fri, 15 May 2020 12:28:47 +0530 Subject: [Libfix] Fixing the pkill command Problem: Below command to 'pkill pidof glusterd' is not right, as it is not getting the pidof glusterd. eg: cmd = "pkill pidof glusterd" ret, out ,err = g.run("10.20.30.40", cmd, "root") >>> ret, out, err (2, '', "pkill: only one pattern can be provided\n Try `pkill --help' for more information.\n") Here command is failing. Solution: Added `pidof glusterd` which will get proper glusterd pid and kill the stale pid after glusterd stop failed. cmd = "pkill `pidof glusterd`" ret, out ,err = g.run("10.20.30.40", cmd, "root") >>> ret, out, err (1, '', '') Note: The ret value is 1, as it is tried on a machine where glusterd is running. The purpose of the fix is to get the proper pid. Change-Id: Iacba3712852b9d16546ced9a4c071c62182fe385 Signed-off-by: Bala Konda Reddy M --- glustolibs-gluster/glustolibs/gluster/gluster_base_class.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'glustolibs-gluster/glustolibs') diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py index b07fe3ed5..65ecd139a 100644 --- a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py +++ b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py @@ -260,7 +260,7 @@ class GlusterBaseClass(TestCase): ret = stop_glusterd(cls.servers) if not ret: g.log.error("Failed to stop glusterd") - cmd_list = ("pkill pidof glusterd", + cmd_list = ("pkill `pidof glusterd`", "rm /var/run/glusterd.socket") for server in cls.servers: for cmd in cmd_list: -- cgit