4 from monitor.wrapper import emailTxt
6 def __init__(self, value):
9 return self.__class__.__name__
12 class Match(Type): pass
13 class ListMatch(Type): pass
14 class FilledIn(Type): pass
15 class PortOpen(Type): pass
16 class NodesUp(Type): pass
18 # a failed constraint leads to a message-escelation process.
19 # so, define a constraint, which defines the set of nodes it operates on, the
20 # message to send if it fails, and maybe a thank you message when it's
21 # satisfied (if previously failed.).
23 'membership' : [ { 'plcnode/nodegroups' : Match('.*') } ],
24 'site' : [ { 'nodes' : NodesUp(2), } ],
25 'node' : { 'constraint' :
26 [ { 'state' : Match('BOOT'),
27 'kernel' : Match('2.6.22.19-vs2.3.0.34'), } ],
28 'failed_message' : [ emailTxt.mailtxt.newdown ],
29 'resolved_message' : [ emailTxt.mailtxt.newthankyou ],
32 'constraint' : [ { 'hostname' : FilledIn(True),
33 'password' : FilledIn(True), },
34 { 'ip' : FilledIn(True),
35 'password' : FilledIn(True), },
37 'failed_message' : [ emailTxt.mailtxt.pcudown ],
38 'resolved_message' : [ emailTxt.mailtxt.pcuthankyou ],
43 # if membership constraint it true, then apply the other constraints.
44 'membership' : [ { 'plcnode/nodegroups' : ListMatch('DC7800Deployment'), } ],
46 'pcu' : { 'constraint' : [ { 'hostname' : FilledIn(True),
47 'ip' : FilledIn(True),
48 'password' : FilledIn(True),
49 'model' : Match('AMT'),
50 'username' : Match('admin'),
51 'portstatus': PortOpen(16992),
54 { 'hostname' : FilledIn(True),
55 'ip' : FilledIn(True),
56 'password' : FilledIn(True),
60 'failed_message' : [ emailTxt.mailtxt.donation_nopcu],
61 'resolved_message' : [ emailTxt.mailtxt.pcuthankyou ],
63 'node' : { 'constraint' :
64 [ { 'state' : Match('BOOT'),
65 'kernel' : Match('2.6.22.19-vs2.3.0.34'), } ],
66 'failed_message' : [ emailTxt.mailtxt.donation_down],
67 'resolved_message' : [ emailTxt.mailtxt.newthankyou ],
72 # data source, { constraints ... value }
73 # action on failure of constraint
74 # information about why it failed
75 # # stop action if constraint is satisfied at a later time.
76 # kind of like asynchronous constraint solving.
77 # or stored procedures.