summaryrefslogtreecommitdiffstats
path: root/pyfirstaidkit
diff options
context:
space:
mode:
authorMartin Sivak <msivak@redhat.com>2008-03-18 15:20:18 +0100
committerMartin Sivak <msivak@redhat.com>2008-03-18 15:21:23 +0100
commitf12d5d6ac67cab511d1f15f41385afd10b8198da (patch)
tree221e67d3b752d6e56c43e4a54e30d9dea6b227f9 /pyfirstaidkit
parent82b28a52f8152e2f155d282cadcc141a8effc680 (diff)
downloadfirstaidkit-f12d5d6ac67cab511d1f15f41385afd10b8198da.tar.gz
firstaidkit-f12d5d6ac67cab511d1f15f41385afd10b8198da.tar.xz
firstaidkit-f12d5d6ac67cab511d1f15f41385afd10b8198da.zip
Add flag handling into the IssuesPlugin
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r--pyfirstaidkit/plugins.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py
index 05464fe..9b25c7f 100644
--- a/pyfirstaidkit/plugins.py
+++ b/pyfirstaidkit/plugins.py
@@ -297,6 +297,7 @@ class IssuesPlugin(Plugin):
Just fill the issue_tests list with classes describing the tests and let it run."""
issue_tests = [] #List of Issue classes to check
+ set_flags = [] #flags to set when everything is OK
def __init__(self, *args, **kwargs):
Plugin.__init__(self, *args, **kwargs)
@@ -321,6 +322,8 @@ Just fill the issue_tests list with classes describing the tests and let it run.
if result:
self._result=ReturnSuccess
+ for flag in self.set_flags:
+ self._dependencies.provide(flag)
else:
self._result=ReturnFailure
@@ -328,9 +331,17 @@ Just fill the issue_tests list with classes describing the tests and let it run.
"""Try to fix whatever is wrong in the system."""
result = False
+ fixed = True
for i in self.tests:
self._reporting.info(level = TASK, origin = self, message = "Fixing '%s'" % (i.name,))
result = result or i.fix()
+ i.reset()
+ if not i.detect() or i.happened():
+ fixed = False
+
+ if fixed:
+ for flag in self.set_flags:
+ self._dependencies.provide(flag)
if result:
self._result=ReturnSuccess