split the various *Api classes into somethin more sensible
[sfa.git] / sfa / server / interface.py
index 1ecee51..7d2beef 100644 (file)
@@ -1,4 +1,4 @@
-from sfa.util.faults import *
+#from sfa.util.faults import *
 from sfa.util.storage import XmlStorage
 import sfa.util.xmlrpcprotocol as xmlrpcprotocol
 
@@ -28,6 +28,7 @@ class Interface:
     def get_server(self, key_file, cert_file, timeout=30):
         server = None 
         if  self.client_type ==  'geniclientlight' and GeniClientLight:
+            # xxx url and self.api are undefined
             server = GeniClientLight(url, self.api.key_file, self.api.cert_file)
         else:
             server = xmlrpcprotocol.get_server(self.get_url(), key_file, cert_file, timeout) 
@@ -69,6 +70,10 @@ class Interfaces(dict):
             # port is appended onto the domain, before the path. Should look like:
             # http://domain:port/path
             hrn, address, port = record['hrn'], record['addr'], record['port']
+            # sometime this is called at a very early stage with no config loaded
+            # avoid to remember this instance in such a case
+            if not address or not port:
+                continue
             interface = Interface(hrn, address, port) 
             self[hrn] = interface