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