1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import time
23
24 from twisted.python import reflect
25
26 from flumotion.common import errors, log, common
27 from flumotion.component.plugs import base
28
29
31 """
32 Base class for plugs that can react to actions by an admin. For
33 example, some plugs might want to check that the admin in question
34 has the right permissions, and some others might want to log the
35 action to a database. Defines the admin action API methods.
36 """
37 - def action(self, identity, method, args, kwargs):
38 """
39 @type identity: L{flumotion.common.identity.Identity}
40 @type method: str
41 @type args: list
42 @type kwargs: dict
43 """
44 raise NotImplementedError('subclasses have to override me')
45
46
48 filename = None
49 file = None
50
59
60 - def stop(self, vishnu):
63
64 - def action(self, identity, method, args, kwargs):
65
66 s = ('[%04d-%02d-%02d %02d:%02d:%02d] %s: %s: %r %r\n'
67 % (time.gmtime()[:6] +
68 ((identity, method, args, kwargs))))
69 self.file.write(s)
70 self.file.flush()
71