1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import random
23
24 from flumotion.twisted import defer
25
26 from flumotion.common.identity import RemoteIdentity
27 from flumotion.component.plugs import base
28
29 __version__ = "$Rev$"
30
31
33 """
34 Base class for plugs can calculate an identity of a remote host. See
35 L{flumotion.manager.manager.Vishnu.computeIdentity} for more
36 information.
37 """
38
40 """
41 @param keycard: the keycard that the remote host used to log in.
42 @type keycard: L{flumotion.common.keycards.Keycard}
43 @param remoteHost: the ip of the remote host
44 @type remoteHost: str
45
46 @rtype: a deferred that will fire a
47 L{flumotion.common.identity.RemoteIdentity}
48 """
49 raise NotImplementedError
50
51
53 """
54 Example implementation of the IdentityProviderPlug socket, randomly
55 chooses an identity for the remote host.
56 """
57
59 i = RemoteIdentity(random.choice(['larry', 'curly', 'moe']),
60 random.choice(['chicago', 'detroit']))
61 return defer.succeed(i)
62