From f12d5d6ac67cab511d1f15f41385afd10b8198da Mon Sep 17 00:00:00 2001 From: Martin Sivak Date: Tue, 18 Mar 2008 15:20:18 +0100 Subject: Add flag handling into the IssuesPlugin --- doc/FLAGS | 7 +++++++ pyfirstaidkit/plugins.py | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/FLAGS b/doc/FLAGS index 0c6929c..cb573d6 100644 --- a/doc/FLAGS +++ b/doc/FLAGS @@ -56,3 +56,10 @@ network_dns network_firewall Part of network configuration was checked and appears OK +rpm +rpm_consistent + RPM database is in OK state and contains the right information +rpm_lowlevel + RPM database has all required files and databases working + + 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 -- cgit