summaryrefslogtreecommitdiffstats
path: root/tasker/plugins.py
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2007-11-22 15:11:43 +0100
committerJoel Andres Granados <jgranado@redhat.com>2007-11-22 15:11:43 +0100
commit9a6c6d665c7d9c9da78ea5488bcd4b8b7f7df211 (patch)
tree8ca389e60ff2d894bad023454430268ce259c376 /tasker/plugins.py
parent83d9690c02e9189ec8ceddc92b2c400f0b1521cb (diff)
downloadfirstaidkit-9a6c6d665c7d9c9da78ea5488bcd4b8b7f7df211.tar.gz
firstaidkit-9a6c6d665c7d9c9da78ea5488bcd4b8b7f7df211.tar.xz
firstaidkit-9a6c6d665c7d9c9da78ea5488bcd4b8b7f7df211.zip
Change all references from init to prepare.
Change all references from purge to clean. Log a warning when abstract functions are not used.
Diffstat (limited to 'tasker/plugins.py')
-rw-r--r--tasker/plugins.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/tasker/plugins.py b/tasker/plugins.py
index 9ce8db4..eca96b4 100644
--- a/tasker/plugins.py
+++ b/tasker/plugins.py
@@ -68,13 +68,13 @@ class Plugin(object):
# with the parent of all ReturnValue classes.
#
self._defflow = {
- self.initial : {ReturnValue: "init"},
- "init" : {ReturnValueTrue: "diagnose"},
- "diagnose" : {ReturnValueTrue: "purge", ReturnValueFalse: "backup"},
- "backup" : {ReturnValueTrue: "fix", ReturnValueFalse: "purge"},
- "fix" : {ReturnValueTrue: "purge", ReturnValueFalse: "restore"},
- "restore" : {ReturnValueTrue: "purge", ReturnValueFalse: "purge"},
- "purge" : {ReturnValueTrue: self.final}
+ self.initial : {ReturnValue: "prepare"},
+ "prepare" : {ReturnValueTrue: "diagnose"},
+ "diagnose" : {ReturnValueTrue: "clean", ReturnValueFalse: "backup"},
+ "backup" : {ReturnValueTrue: "fix", ReturnValueFalse: "clean"},
+ "fix" : {ReturnValueTrue: "clean", ReturnValueFalse: "restore"},
+ "restore" : {ReturnValueTrue: "clean", ReturnValueFalse: "clean"},
+ "clean" : {ReturnValueTrue: self.final}
}
self._flows["default"] = self._defflow
@@ -121,7 +121,7 @@ class Plugin(object):
#list of all actions provided
def actions(self):
"""Returns list of available actions"""
- return set(["init", "backup", "diagnose", "describe", "fix", "restore", "purge"])
+ return set(["prepare", "backup", "diagnose", "describe", "fix", "restore", "clean"])
def nextstate(self, state=None, result=None):
"""Returns next state when analizing self._state, self._result and the self.cflow in automode.
@@ -174,7 +174,7 @@ class Plugin(object):
#
#default (mandatory) plugin actions
#
- def init(self):
+ def prepare(self):
"""Initial actions.
All the actions that must be done before the execution of any plugin function.
@@ -182,9 +182,9 @@ class Plugin(object):
"""
#We want these functions to be overridden by the plugin developer.
if self.__class__ is Plugin:
- raise TypeError, "Plugin is an abstract class."
+ Logger.warrning("Clean is an abstract method, it should be used as such.")
- def purge(self):
+ def clean(self):
"""Final actions.
All the actions that must be done after the exection of all plugin functions.
@@ -193,31 +193,31 @@ class Plugin(object):
"""
#We want these functions to be overridden by the plugin developer.
if self.__class__ is Plugin:
- raise TypeError, "Plugin is an abstract class."
+ Logger.warrning("Clean is an abstract method, it should be used as such.")
def backup(self):
"""Gather important information needed for restore."""
#We want these functions to be overridden by the plugin developer.
if self.__class__ is Plugin:
- raise TypeError, "Plugin is an abstract class."
+ Logger.warrning("Clean is an abstract method, it should be used as such.")
def restore(self):
"""Try to restore the previous state described in backup."""
#We want these functions to be overridden by the plugin developer.
if self.__class__ is Plugin:
- raise TypeError, "Plugin is an abstract class."
+ Logger.warrning("Clean is an abstract method, it should be used as such.")
def diagnose(self):
"""Diagnose the situation."""
#We want these functions to be overridden by the plugin developer.
if self.__class__ is Plugin:
- raise TypeError, "Plugin is an abstract class."
+ Logger.warrning("Clean is an abstract method, it should be used as such.")
def fix(self):
"""Try to fix whatever is wrong in the system."""
#We want these functions to be overridden by the plugin developer.
if self.__class__ is Plugin:
- raise TypeError, "Plugin is an abstract class."
+ Logger.warrning("Clean is an abstract method, it should be used as such.")
class PluginSystem(object):
"""Encapsulate all plugin detection and import stuff"""