cosmetic
[sfa.git] / sfa / managers / driver.py
1
2 # an attempt to document what a driver class should provide, 
3 # and implement reasonable defaults
4 #
5
6 class Driver:
7     
8     def __init__ (self): pass
9
10     # redefine this if you want to check again records 
11     # when running GetCredential
12     # This is to reflect the 'enabled' user field in planetlab testbeds
13     # expected retcod boolean
14     def is_enabled_entity (self, record) : 
15         return True
16     
17     # incoming record, as provided by the client to the Register API call
18     # expected retcod 'pointer'
19     # 'pointer' is typically an int db id, that makes sense in the testbed environment
20     # -1 if this feature is not relevant 
21     # here type will be 'authority'
22     def register (self, sfa_record, hrn, pub_key) : 
23         return -1
24
25     # incoming record is the existing sfa_record
26     # expected retcod boolean, error message logged if result is False
27     def remove (self, sfa_record): 
28         return True
29
30     # incoming are the sfa_record:
31     # (*) old_sfa_record is what we have in the db for that hrn
32     # (*) new_sfa_record is what was passed in the Update call
33     # expected retcod boolean, error message logged if result is False
34     # NOTE 1. about keys
35     # this is confusing because a user may have several ssh keys in 
36     # the planetlab database, but we need to pick one to generate its cert
37     # so as much as in principle we should be able to use new_sfa_record['keys']
38     # the manager code actually picks one (the first one), and it seems safer
39     # to pass it along rather than depending on the driver code to do the same
40     #
41     # NOTE 2. about keys
42     # when changing the ssh key through this method the gid gets changed too
43     # should anything be passed back to the caller in this case ?
44     def update (self, old_sfa_record, new_sfa_record, hrn, new_key): 
45         return True