diff options
author | Martin Sivak <msivak@redhat.com> | 2008-03-19 11:24:23 +0100 |
---|---|---|
committer | Martin Sivak <msivak@redhat.com> | 2008-03-19 11:24:23 +0100 |
commit | 1b34958d6340403ce9c5d1f715d7edfcd74071b0 (patch) | |
tree | 0af6267b9f75cc1a2b30f5a7c367afef772d8a6f /pyfirstaidkit/plugins.py | |
parent | 08731be503c8755af606fa61526af47aca391eff (diff) | |
download | firstaidkit-1b34958d6340403ce9c5d1f715d7edfcd74071b0.tar.gz firstaidkit-1b34958d6340403ce9c5d1f715d7edfcd74071b0.tar.xz firstaidkit-1b34958d6340403ce9c5d1f715d7edfcd74071b0.zip |
Fix the return values and flag logic of IssuesPlugin
Diffstat (limited to 'pyfirstaidkit/plugins.py')
-rw-r--r-- | pyfirstaidkit/plugins.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py index 9b25c7f..c36c98f 100644 --- a/pyfirstaidkit/plugins.py +++ b/pyfirstaidkit/plugins.py @@ -314,18 +314,22 @@ Just fill the issue_tests list with classes describing the tests and let it run. """Diagnose the situation.""" result = False + happened = False for i in self.tests: self._reporting.info(level = TASK, origin = self, message = "Investigating '%s'" % (i.name,)) result = result or i.detect() if i.happened(): + happened = True self._reporting.info(level = TASK, origin = self, message = i.str()) - if result: + if result and not happened: self._result=ReturnSuccess for flag in self.set_flags: self._dependencies.provide(flag) - else: + elif result: self._result=ReturnFailure + else: + self._result = None def fix(self): """Try to fix whatever is wrong in the system.""" @@ -335,18 +339,22 @@ Just fill the issue_tests list with classes describing the tests and let it run. for i in self.tests: self._reporting.info(level = TASK, origin = self, message = "Fixing '%s'" % (i.name,)) result = result or i.fix() + if not i.fixed(): + fixed = False + continue + i.reset() if not i.detect() or i.happened(): fixed = False - if fixed: + if result and fixed: + self._result=ReturnSuccess for flag in self.set_flags: self._dependencies.provide(flag) - - if result: - self._result=ReturnSuccess - else: + elif result: self._result=ReturnFailure + else: + self._result = None class FlagTrackerPlugin(Plugin): |