summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMartin Sivak <msivak@redhat.com>2008-03-05 14:15:36 +0100
committerMartin Sivak <msivak@redhat.com>2008-03-05 14:15:36 +0100
commitb9e406a6255e2f0f14c966acb492f2d4e8d3da8c (patch)
tree5f61f9abc34145ca14143ad72785d5262da93915 /plugins
parent379616173fb52318300334efdee234a251ad8302 (diff)
downloadfirstaidkit-b9e406a6255e2f0f14c966acb492f2d4e8d3da8c.tar.gz
firstaidkit-b9e406a6255e2f0f14c966acb492f2d4e8d3da8c.tar.xz
firstaidkit-b9e406a6255e2f0f14c966acb492f2d4e8d3da8c.zip
Sanitize the origin/level/importance system
Use reporting when possible (some messages automatically use Logger to avoid duplication) Improve the Output thread to use the new level/importance system
Diffstat (limited to 'plugins')
-rw-r--r--plugins/passwd.py2
-rw-r--r--plugins/plugin_examples/sample1Plugin.py14
2 files changed, 9 insertions, 7 deletions
diff --git a/plugins/passwd.py b/plugins/passwd.py
index fab9443..c55b64c 100644
--- a/plugins/passwd.py
+++ b/plugins/passwd.py
@@ -56,7 +56,7 @@ class PasswdPlugin(Plugin):
print spawnvch(executable = "/usr/bin/passwd", args = ["/usr/bin/passwd", "root"], chroot = Config.system.root).communicate(input = newpasswd+"\n"+newpasswd+"\n")
- self._reporting.info("Root password was reset to '%s'" % (newpasswd,), origin = self)
+ self._reporting.info("Root password was reset to '%s'" % (newpasswd,), level = PLUGIN, origin = self)
self._result=Return
diff --git a/plugins/plugin_examples/sample1Plugin.py b/plugins/plugin_examples/sample1Plugin.py
index 22d033f..bb8b24e 100644
--- a/plugins/plugin_examples/sample1Plugin.py
+++ b/plugins/plugin_examples/sample1Plugin.py
@@ -16,8 +16,10 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from pyfirstaidkit.plugins import Plugin,Flow
+from pyfirstaidkit.reporting import PLUGIN
from pyfirstaidkit.returns import *
+
class Sample1Plugin(Plugin):
"""This plugin uses the predefined flow in the Plugin abstract class."""
name = "Sample1Plugin"
@@ -29,27 +31,27 @@ class Sample1Plugin(Plugin):
def prepare(self):
self._result=ReturnSuccess
- self.reporting.info("Sample1Plugin in Prepare task", self)
+ self.reporting.info("Sample1Plugin in Prepare task", origin = self, level = PLUGIN)
def backup(self):
self._result=ReturnSuccess
- self.reporting.info("Sample1Plugin in backup task", self)
+ self.reporting.info("Sample1Plugin in backup task", origin = self, level = PLUGIN)
def restore(self):
self._result=ReturnSuccess
- self.reporting.info("Sample1Plugin in Restore task", self)
+ self.reporting.info("Sample1Plugin in Restore task", origin = self, level = PLUGIN)
def diagnose(self):
self._result=ReturnSuccess
- self.reporting.info("Sample1Plugin in diagnose task", self)
+ self.reporting.info("Sample1Plugin in diagnose task", origin = self, level = PLUGIN)
def fix(self):
self._result=ReturnFailure
- self.reporting.info("Sample1Plugin in Fix task", self)
+ self.reporting.info("Sample1Plugin in Fix task", origin = self, level = PLUGIN)
def clean(self):
self._result=ReturnSuccess
- self.reporting.info("Sample1Plugin in Clean task", self)
+ self.reporting.info("Sample1Plugin in Clean task", origin = self, level = PLUGIN)
def get_plugin():
return Sample1Plugin