group db-related stuff in sfa/storage
[sfa.git] / sfa / methods / get_key_from_incoming_ip.py
1 from sfa.util.method import Method
2 from sfa.util.sfalogging import logger
3
4 from sfa.storage.parameter import Parameter
5
6 class get_key_from_incoming_ip(Method):
7     """
8     Generate a new keypair and gid for requesting caller (component/node).     
9     This is a myplc-specific API call used by component manager
10     @return 1 If successful  
11     """
12
13     interfaces = ['registry']
14     
15     accepts = []
16
17     returns = Parameter(int, "1 if successful, faults otherwise")
18     
19     def call(self):
20         if hasattr(self.api.manager,'get_key_from_incoming_ip'):
21             return self.api.manager.get_key_from_incoming_ip (api)
22         else:
23             logger.warning("get_key_from_incoming_ip not supported by registry manager")
24             return 0