summaryrefslogtreecommitdiffstats
path: root/tasker/plugins.py
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2007-11-21 12:13:48 +0100
committerJoel Andres Granados <jgranado@redhat.com>2007-11-21 12:13:48 +0100
commitd39f1d92e4251daca8234591a760c7e31a80ca5d (patch)
treea0c3eb24fa8f7ef2ec81a8d370b7d337b5210a9c /tasker/plugins.py
parent25aa7953d53896234cd6911bdca3ae319fefcec4 (diff)
downloadfirstaidkit-d39f1d92e4251daca8234591a760c7e31a80ca5d.tar.gz
firstaidkit-d39f1d92e4251daca8234591a760c7e31a80ca5d.tar.xz
firstaidkit-d39f1d92e4251daca8234591a760c7e31a80ca5d.zip
Took away the BinPlugin class. It is not needed because the plugin
developer can use the subprocess functionality that python provides. This functionality will be far more general that whatever we can privide. Some other minor changes.
Diffstat (limited to 'tasker/plugins.py')
-rw-r--r--tasker/plugins.py49
1 files changed, 10 insertions, 39 deletions
diff --git a/tasker/plugins.py b/tasker/plugins.py
index 58d8d39..a8b066e 100644
--- a/tasker/plugins.py
+++ b/tasker/plugins.py
@@ -89,13 +89,17 @@ class Plugin(object):
def info(self):
"""Returns tuple (Plugin name, Plugin version, Plugin author)"""
- return ("Dummy plugin", "0.0.1", "Martin Sivak <msivak@redhat.com>")
+ return ("Plugin", "", "")
+ #
+ # The flow functions.
+ #
def changeFlow(self, name):
"""Changes the current flow to name.
name -- name of flow
- returns true upon completion, raises a InvalidFlowNameError.
+ returns true upon completion, raises a InvalidFlowNameError. This will not check for
+ running flows. If it is necesary we will do that in the future.
"""
try:
self.cflow = self._flows[name]
@@ -103,6 +107,10 @@ class Plugin(object):
raise InvalidFlowNameError(name, self._flow)
return True
+ def getFlows(self):
+ """Return the names of all possible flows."""
+ return self._flows.keys()
+
#list of all actions provided
def actions(self):
"""Returns list of available actions"""
@@ -202,43 +210,6 @@ class Plugin(object):
if self.__class__ is Plugin:
raise TypeError, "Plugin is an abstract class."
-class BinPlugin(Plugin):
- def __init__(self, bin):
- Plugin.__init__(self)
- self._binpath = bin
- self._output = {}
-
- def common(self, step, okresult = True, failresult = False):
- ind = ""
- proc = subprocess.Popen([self._binpath, step], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
- (out, _) = proc.communicate(ind)
- err = proc.returncode
- self._output[step] = out
- if err==0:
- self._result = okresult
- return True
- else:
- self._result = failresult
- return False
-
- def init(self):
- return self.common("init")
-
- def purge(self):
- return self.common("purge")
-
- def backup(self):
- return self.common("backup")
-
- def restore(self):
- return self.common("restore")
-
- def diagnose(self):
- return self.common("diagnose")
-
- def fix(self):
- return self.common("fix")
-
class PluginSystem(object):
"""Encapsulate all plugin detection and import stuff"""