diff options
author | Martin Sivak <msivak@redhat.com> | 2008-05-05 15:46:38 +0200 |
---|---|---|
committer | Martin Sivak <msivak@redhat.com> | 2008-05-05 15:46:38 +0200 |
commit | dda25ee4e1ca17cd333f10fcf0c825b60105da9c (patch) | |
tree | 38b57154fda72b4d2bf07bced54c3fe9be7924b3 /plugins/plugin_examples/sample3Plugin/sample3Plugin.py | |
parent | c227496fa86c36762018c2a8219f2136ec63fa10 (diff) | |
download | firstaidkit-dda25ee4e1ca17cd333f10fcf0c825b60105da9c.tar.gz firstaidkit-dda25ee4e1ca17cd333f10fcf0c825b60105da9c.tar.xz firstaidkit-dda25ee4e1ca17cd333f10fcf0c825b60105da9c.zip |
Use Issue reporting in plugins
Diffstat (limited to 'plugins/plugin_examples/sample3Plugin/sample3Plugin.py')
-rw-r--r-- | plugins/plugin_examples/sample3Plugin/sample3Plugin.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/plugin_examples/sample3Plugin/sample3Plugin.py b/plugins/plugin_examples/sample3Plugin/sample3Plugin.py index cac5f70..d3a3f21 100644 --- a/plugins/plugin_examples/sample3Plugin/sample3Plugin.py +++ b/plugins/plugin_examples/sample3Plugin/sample3Plugin.py @@ -18,6 +18,8 @@ from pyfirstaidkit.returns import * from pyfirstaidkit.plugins import Plugin,Flow from pyfirstaidkit import Config +from pyfirstaidkit.issue import SimpleIssue +from pyfirstaidkit.reporting import PLUGIN import subprocess class Sample3Plugin(Plugin): @@ -28,9 +30,11 @@ class Sample3Plugin(Plugin): def __init__(self, *args, **kwargs): Plugin.__init__(self, *args, **kwargs) + self._issue = SimpleIssue(self.name, self.description) def prepare(self): # Prepare command line. + self._issue.set(detected = False, reporting = self._reporting, origin = self, level = PLUGIN) prepare = [self._path + "/plugin", "--task", "prepare"] proc = subprocess.Popen(prepare, stdout=subprocess.PIPE) (out, err) = proc.communicate() @@ -79,6 +83,7 @@ class Sample3Plugin(Plugin): self._result=ReturnFailure elif out[-4:] == "true": self._result=ReturnSuccess + self._issue.set(detected = True, happened = (self._result==ReturnFailure), reporting = self._reporting, origin = self, level = PLUGIN) def fix(self): fix = [self._path+"/plugin", "--task", "fix"] @@ -89,3 +94,5 @@ class Sample3Plugin(Plugin): self._result=ReturnFailure elif out[-4:] == "true": self._result=ReturnSuccess + self._issue.set(fixed = (self._result==ReturnSuccess), reporting = self._reporting, origin = self, level = PLUGIN) + |