From aa9225481b0d8a3f29ab84d330f9a7013ffaae11 Mon Sep 17 00:00:00 2001 From: astokes Date: Tue, 20 Oct 2009 18:14:43 +0000 Subject: - removing threaded, replaced with process based execution - altered selinux plugin to give option to do fixfiles or not git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@652 ef72aa8b-4018-0410-8976-d6e080ef94d8 --- src/lib/sos/plugins/selinux.py | 7 ++++--- src/lib/sos/plugintools.py | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/lib') diff --git a/src/lib/sos/plugins/selinux.py b/src/lib/sos/plugins/selinux.py index 62def4fd..7aaa6755 100644 --- a/src/lib/sos/plugins/selinux.py +++ b/src/lib/sos/plugins/selinux.py @@ -18,13 +18,14 @@ import commands class selinux(sos.plugintools.PluginBase): """selinux related information """ + optionList = [("fixfiles", 'Print incorrect file context labels', 'slow', False)] def setup(self): # sestatus is always collected in checkenabled() self.addCopySpec("/etc/selinux") self.collectExtOutput("/usr/bin/selinuxconfig") - self.eta_weight += 120 # this plugins takes 120x longer (for ETA) - self.collectExtOutput("/sbin/fixfiles check") - + self.eta_weight += 240 # this plugins takes 240x longer (for ETA) + if self.getOption('fixfiles'): + self.collectExtOutput("/sbin/fixfiles check") self.addForbiddenPath("/etc/selinux/targeted") return diff --git a/src/lib/sos/plugintools.py b/src/lib/sos/plugintools.py index 684cd9eb..9121db69 100644 --- a/src/lib/sos/plugintools.py +++ b/src/lib/sos/plugintools.py @@ -29,11 +29,11 @@ This is the base class for sosreport plugins """ from sos.helpers import * -from threading import Thread, activeCount import os, os.path, sys, string, glob, re, traceback import shutil from stat import * from time import time +from multiprocessing import Process class PluginException(Exception): pass @@ -426,7 +426,7 @@ class PluginBase: """ if threaded, is thread running ? """ - if self.thread: return self.thread.isAlive() + if self.thread: return self.thread.is_alive() return None def wait(self,timeout=None): @@ -434,14 +434,14 @@ class PluginBase: wait for a thread to complete - only called for threaded execution """ self.thread.join(timeout) - return self.thread.isAlive() + return self.thread.is_alive() def copyStuff(self, threaded = False, semaphore = None): """ Collect the data for a plugin """ if threaded and self.thread == None: - self.thread = Thread(target=self.copyStuff, name=self.piName+'-thread', args = [True, semaphore] ) + self.thread = Process(target=self.copyStuff, name=self.piName+'-thread', args = [True, semaphore] ) self.thread.start() return self.thread -- cgit