From adc1be1ecab468aed5dbac64b7b7d1ce0cc92180 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Tue, 8 Apr 2014 13:48:40 +0100 Subject: Replace os.system() in gluster plugin with self.check_ext_prog() Plugins should not open-code calls to external commands. Use the build-in check_ext_prog() interface instead and test for success before attempting to collect the statedump files. Signed-off-by: Bryn M. Reeves --- sos/plugins/gluster.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py index d9c35d3b..795dfa0a 100644 --- a/sos/plugins/gluster.py +++ b/sos/plugins/gluster.py @@ -93,14 +93,15 @@ class Gluster(Plugin, RedHatPlugin): self.add_copy_spec("/etc/glusterfs") self.make_preparations(self.statedump_dir) - #self.add_cmd_output("killall -USR1 glusterfs glusterfsd") - os.system("killall -USR1 glusterfs glusterfsd"); - # let all the processes catch the signal and create statedump file - # entries. - time.sleep(1) - self.wait_for_statedump(self.statedump_dir) - self.add_copy_spec('/tmp/glusterdump.options') - self.add_copy_spec(self.statedump_dir) + if self.check_ext_prog("killall -USR1 glusterfs glusterfsd"): + # let all the processes catch the signal and create statedump file + # entries. + time.sleep(1) + self.wait_for_statedump(self.statedump_dir) + self.add_copy_spec('/tmp/glusterdump.options') + self.add_copy_spec(self.statedump_dir) + else: + self.soslog.warning("could not send SIGUSR1 to glusterfs processes") volume_file = self.get_cmd_output_now("gluster volume info", "gluster_volume_info") -- cgit