summaryrefslogtreecommitdiffstats
path: root/plugins/plugin_examples
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugin_examples')
-rw-r--r--plugins/plugin_examples/dep1.py6
-rw-r--r--plugins/plugin_examples/dep2.py6
-rw-r--r--plugins/plugin_examples/dep3.py6
-rw-r--r--plugins/plugin_examples/sample1Plugin.py6
-rw-r--r--plugins/plugin_examples/sample2Plugin.py6
-rw-r--r--plugins/plugin_examples/sample3Plugin/sample3Plugin.py7
6 files changed, 36 insertions, 1 deletions
diff --git a/plugins/plugin_examples/dep1.py b/plugins/plugin_examples/dep1.py
index 0fe673a..a39beda 100644
--- a/plugins/plugin_examples/dep1.py
+++ b/plugins/plugin_examples/dep1.py
@@ -17,6 +17,8 @@
from pyfirstaidkit.plugins import Plugin,Flow
from pyfirstaidkit.returns import *
+from pyfirstaidkit.issue import SimpleIssue
+from pyfirstaidkit.reporting import PLUGIN
class Sample1Plugin(Plugin):
"""This plugin uses the predefined flow in the Plugin abstract class."""
@@ -25,6 +27,7 @@ class Sample1Plugin(Plugin):
author = "Joel Andres Granados"
def __init__(self, *args, **kwargs):
Plugin.__init__(self, *args, **kwargs)
+ self._issue = SimpleIssue(self.name, self.description)
@classmethod
def getDeps(cls):
@@ -32,6 +35,7 @@ class Sample1Plugin(Plugin):
def prepare(self):
self._result=ReturnSuccess
+ self._issue.set(detected = False, reporting = self._reporting, origin = self, level = PLUGIN)
def backup(self):
self._result=ReturnSuccess
@@ -42,9 +46,11 @@ class Sample1Plugin(Plugin):
def diagnose(self):
self._result=ReturnSuccess
self.provide("sample_dependency2")
+ self._issue.set(detected = True, happened = False, reporting = self._reporting, origin = self, level = PLUGIN)
def fix(self):
self._result=ReturnFailure
+ self._issue.set(fixed = False, reporting = self._reporting, origin = self, level = PLUGIN)
def clean(self):
self._result=ReturnSuccess
diff --git a/plugins/plugin_examples/dep2.py b/plugins/plugin_examples/dep2.py
index e8e8f43..1a0e0fd 100644
--- a/plugins/plugin_examples/dep2.py
+++ b/plugins/plugin_examples/dep2.py
@@ -17,6 +17,8 @@
from pyfirstaidkit.plugins import Plugin,Flow
from pyfirstaidkit.returns import *
+from pyfirstaidkit.reporting import PLUGIN
+from pyfirstaidkit.issue import SimpleIssue
class Sample1Plugin(Plugin):
"""This plugin uses the predefined flow in the Plugin abstract class."""
@@ -25,6 +27,7 @@ class Sample1Plugin(Plugin):
author = "Joel Andres Granados"
def __init__(self, *args, **kwargs):
Plugin.__init__(self, *args, **kwargs)
+ self._issue = SimpleIssue(self.name, self.description)
@classmethod
def getDeps(cls):
@@ -32,6 +35,7 @@ class Sample1Plugin(Plugin):
def prepare(self):
self._result=ReturnSuccess
+ self._issue.set(detected = False, reporting = self._reporting, origin = self, level = PLUGIN)
def backup(self):
self._result=ReturnSuccess
@@ -41,9 +45,11 @@ class Sample1Plugin(Plugin):
def diagnose(self):
self._result=ReturnSuccess
+ self._issue.set(detected = True, happened = False, reporting = self._reporting, origin = self, level = PLUGIN)
def fix(self):
self._result=ReturnFailure
+ self._issue.set(fixed = False, reporting = self._reporting, origin = self, level = PLUGIN)
def clean(self):
self._result=ReturnSuccess
diff --git a/plugins/plugin_examples/dep3.py b/plugins/plugin_examples/dep3.py
index 3da70ea..fb109c4 100644
--- a/plugins/plugin_examples/dep3.py
+++ b/plugins/plugin_examples/dep3.py
@@ -17,6 +17,8 @@
from pyfirstaidkit.plugins import Plugin,Flow
from pyfirstaidkit.returns import *
+from pyfirstaidkit.reporting import PLUGIN
+from pyfirstaidkit.issue import SimpleIssue
class Sample1Plugin(Plugin):
"""This plugin uses the predefined flow in the Plugin abstract class."""
@@ -25,9 +27,11 @@ class Sample1Plugin(Plugin):
author = "Joel Andres Granados"
def __init__(self, *args, **kwargs):
Plugin.__init__(self, *args, **kwargs)
+ self._issue = SimpleIssue(self.name, self.description)
def prepare(self):
self._result=ReturnSuccess
+ self._issue.set(detected = False, reporting = self._reporting, origin = self, level = PLUGIN)
def backup(self):
self._result=ReturnSuccess
@@ -38,9 +42,11 @@ class Sample1Plugin(Plugin):
def diagnose(self):
self._result=ReturnSuccess
self.provide("sample_dependency")
+ self._issue.set(detected = True, happened = False, reporting = self._reporting, origin = self, level = PLUGIN)
def fix(self):
self._result=ReturnFailure
+ self._issue.set(fixed = False, reporting = self._reporting, origin = self, level = PLUGIN)
def clean(self):
self._result=ReturnSuccess
diff --git a/plugins/plugin_examples/sample1Plugin.py b/plugins/plugin_examples/sample1Plugin.py
index 90e9874..560f69d 100644
--- a/plugins/plugin_examples/sample1Plugin.py
+++ b/plugins/plugin_examples/sample1Plugin.py
@@ -18,7 +18,7 @@
from pyfirstaidkit.plugins import Plugin,Flow
from pyfirstaidkit.reporting import PLUGIN
from pyfirstaidkit.returns import *
-
+from pyfirstaidkit.issue import SimpleIssue
class Sample1Plugin(Plugin):
"""This plugin uses the predefined flow in the Plugin abstract class."""
@@ -27,9 +27,11 @@ class Sample1Plugin(Plugin):
author = "Joel Andres Granados"
def __init__(self, *args, **kwargs):
Plugin.__init__(self, *args, **kwargs)
+ self._issue = SimpleIssue(self.name, self.description)
def prepare(self):
self._result=ReturnSuccess
+ self._issue.set(reporting = self._reporting, origin = self, level = PLUGIN)
self._reporting.info("Sample1Plugin in Prepare task", origin = self, level = PLUGIN)
def backup(self):
@@ -42,10 +44,12 @@ class Sample1Plugin(Plugin):
def diagnose(self):
self._result=ReturnSuccess
+ self._issue.set(detected = True, happened = False, reporting = self._reporting, origin = self, level = PLUGIN)
self._reporting.info("Sample1Plugin in diagnose task", origin = self, level = PLUGIN)
def fix(self):
self._result=ReturnFailure
+ self._issue.set(fixed = False, reporting = self._reporting, origin = self, level = PLUGIN)
self._reporting.info("Sample1Plugin in Fix task", origin = self, level = PLUGIN)
def clean(self):
diff --git a/plugins/plugin_examples/sample2Plugin.py b/plugins/plugin_examples/sample2Plugin.py
index e48389a..aab679c 100644
--- a/plugins/plugin_examples/sample2Plugin.py
+++ b/plugins/plugin_examples/sample2Plugin.py
@@ -17,6 +17,8 @@
from pyfirstaidkit.plugins import Plugin,Flow
from pyfirstaidkit.returns import *
+from pyfirstaidkit.issue import SimpleIssue
+from pyfirstaidkit.reporting import PLUGIN
class Sample2Plugin(Plugin):
"""This plugin will defin one more function and use it in a newly defined fix flow."""
@@ -41,8 +43,10 @@ class Sample2Plugin(Plugin):
def __init__(self, *args, **kwargs):
Plugin.__init__(self, *args, **kwargs)
+ self._issue = SimpleIssue(self.name, self.description)
def prepare(self):
+ self._issue.set(reporting = self._reporting, origin = self, level = PLUGIN)
self._result=ReturnSuccess
def clean(self):
@@ -55,9 +59,11 @@ class Sample2Plugin(Plugin):
self._result=ReturnSuccess
def diagnose(self):
+ self._issue.set(detected = True, happened = True, reporting = self._reporting, origin = self, level = PLUGIN)
self._result=ReturnFailure
def fix(self):
+ self._issue.set(fixed = True, reporting = self._reporting, origin = self, level = PLUGIN)
self._result=ReturnSuccess
def extraStep(self):
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)
+