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 __version__ = "$Rev: 7352 $"
30
31
33 """
34 Base class for plugs that can react to actions by an admin. For
35 example, some plugs might want to check that the admin in question
36 has the right permissions, and some others might want to log the
37 action to a database. Defines the admin action API methods.
38 """
39
40 - def action(self, identity, method, args, kwargs):
41 """
42 @type identity: L{flumotion.common.identity.Identity}
43 @type method: str
44 @type args: list
45 @type kwargs: dict
46 """
47 raise NotImplementedError('subclasses have to override me')
48
49
51 filename = None
52 file = None
53
62
63 - def stop(self, vishnu):
66
67 - def action(self, identity, method, args, kwargs):
68
69 s = ('[%04d-%02d-%02d %02d:%02d:%02d] %s: %s: %r %r\n'
70 % (time.gmtime()[:6] +
71 ((identity, method, args, kwargs))))
72 self.file.write(s)
73 self.file.flush()
74