1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# First Aid Kit - diagnostic and repair tool for Linux
# Copyright (C) 2007 Martin Sivak <msivak@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# These classes expressed here are to be the keys in the flow dictionary.
# In most default cases the attributes are unimportant. They are placed there
# for printing or other purposes.
# Think of those classes as of predefined constants.
#
class Return:
"""Its just a parent class for any Return class that might be create."""
def __init__(self):
pass
class ReturnTrue(Return):
pass
class ReturnFalse(Return):
pass
class ReturnNone(Return):
pass
class ReturnBack(Return):
pass
class ReturnAbort(Return):
pass
#
# The Success and Failure return classes are implemented to give a more
# intuitive/logical approach to the default flow. The value given to the return
# of each task depends on the objectives of the task and of the place where the
# task is situated inside the totality of the flow.
# Examples:
# 1. If the plugin is in the diagnose flow and if found nothing wrong with the
# system it is analysing, the return value would be Success.
# 2. If the plugin is in backup and the backup action is unseccessfull, the
# proper return value would be Failure. In this Success would mean that
# the backup was successfull and the plugin can move toward the fix task.
# 3. If the plugin is in fix stage and the problem was not fixed, the return
# value should be Failure. On the other hand if the fix has been done
# the return value should be Success.
# Remember that the actual values of the classes is not checked, what is
# checked
# is that the return value be the specific class.
#
class ReturnSuccess(Return):
"""Use whenever the result of a task is positive, expected or offers the
least resistence.
"""
pass
class ReturnFailure(Return):
"""Used whenever the result of a task is not possitive, not expected or
offers the most resistence.
"""
pass
|