fixed a bug when checking for invalid records
[sfa.git] / sfa / server / interface.py
index 9b4c039..d6dc5c4 100644 (file)
@@ -127,7 +127,10 @@ class Interfaces(dict):
         the db.         
         """
         # get hrns we expect to find
-        hrns_expected = [interface['hrn'] for interface in self.interfaces]
+        # ignore records for local interfaces
+        ignore_interfaces = [self.api.config.SFA_INTERFACE_HRN]
+        hrns_expected = [interface['hrn'] for interface in self.interfaces \
+                         if interface['hrn'] not in ignore_interfaces]
 
         # get hrns that actually exist in the db
         table = SfaTable()
@@ -163,9 +166,9 @@ class Interfaces(dict):
             interfaces = [interfaces]
         for interface in interfaces:
             # make sure the required fields are present and not null
-            for key in required_fields:
-                if not interface.get(key):
-                    continue 
+            if not all([interface.get(key) for key in required_fields]):
+                continue
             hrn, address, port = interface['hrn'], interface['addr'], interface['port']
             url = 'http://%(address)s:%(port)s' % locals()
             # check which client we should use