diff options
author | Martin Sivak <msivak@redhat.com> | 2008-04-23 15:48:01 +0200 |
---|---|---|
committer | Martin Sivak <msivak@redhat.com> | 2008-04-23 15:48:01 +0200 |
commit | 5231fb4a9dfe0634c4fedad39fed940469028cf9 (patch) | |
tree | 0b956a0998070aaa5985be35946f8795fbfc43d5 /pyfirstaidkit | |
parent | 623ce1116eafcafb8deb805f352698dc2684fca0 (diff) | |
download | firstaidkit-5231fb4a9dfe0634c4fedad39fed940469028cf9.tar.gz firstaidkit-5231fb4a9dfe0634c4fedad39fed940469028cf9.tar.xz firstaidkit-5231fb4a9dfe0634c4fedad39fed940469028cf9.zip |
Issue reporting and Tasker interrupt
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r-- | pyfirstaidkit/interpret.py | 8 | ||||
-rw-r--r-- | pyfirstaidkit/reporting.py | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/pyfirstaidkit/interpret.py b/pyfirstaidkit/interpret.py index d658245..c81cdaf 100644 --- a/pyfirstaidkit/interpret.py +++ b/pyfirstaidkit/interpret.py @@ -33,6 +33,7 @@ class Tasker: def __init__(self, cfg, reporting = None, dependencies = None, backups = None, pluginsystem = None): self._config = cfg + self._running = True if dependencies is None: self._provide = Dependencies() @@ -54,6 +55,10 @@ class Tasker: else: self.pluginSystem = pluginsystem + def interrupt(self): + self._running = False + self._reporting.info("You sent an interrupt signal to Tasker! This is not recommended.", level = TASKER, origin = self, importance = logging.WARNING) + def flags(self): return self._provide @@ -105,7 +110,8 @@ class Tasker: oldlist = set() actlist = set(zip(pluginlist, flows)) - while len(actlist)>0 and oldlist!=actlist: + self._running = True + while self._running and len(actlist)>0 and oldlist!=actlist: oldlist = copy.copy(actlist) for plugin,flow in oldlist: #If plugin does not contain the automated flow or if it ran correctly, remove it from list diff --git a/pyfirstaidkit/reporting.py b/pyfirstaidkit/reporting.py index 934a6ef..8a19a07 100644 --- a/pyfirstaidkit/reporting.py +++ b/pyfirstaidkit/reporting.py @@ -149,7 +149,7 @@ class Reports(object): def issue(self, issue, level, origin, importance = logging.INFO): Logger.debug(origin.name+": issue changed state to "+str(issue)) - return self.put(issue, level, origin, INFO, importance = importance) + return self.put(issue, level, origin, ISSUE, importance = importance) def info(self, message, level, origin, importance = logging.INFO): Logger.info(origin.name+": "+message) |