aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2014-04-08 13:48:40 +0100
committerBryn M. Reeves <bmr@redhat.com>2014-04-08 13:48:40 +0100
commitadc1be1ecab468aed5dbac64b7b7d1ce0cc92180 (patch)
treece739a19d23b094a513d9348f66dd3cefee6d5f5
parentfe44d569b172c00ea2b9ced789bed7d5760a9569 (diff)
downloadsos-adc1be1ecab468aed5dbac64b7b7d1ce0cc92180.tar.gz
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 <bmr@redhat.com>
-rw-r--r--sos/plugins/gluster.py17
1 files 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")