- self.interfaces = self.interface_info.values()[0].values()[0]
- if not isinstance(self.interfaces, list):
- self.interfaces = [self.interfaces]
-
+ interfaces = self.interface_info.values()[0].values()[0]
+ if not isinstance(interfaces, list):
+ interfaces = [self.interfaces]
+ # set the url and urn
+ for interface in interfaces:
+ # port is appended onto the domain, before the path. Should look like:
+ # http://domain:port/path
+ hrn, address, port = interface['hrn'], interface['addr'], interface['port']
+ address_parts = address.split('/')
+ address_parts[0] = address_parts[0] + ":" + str(port)
+ url = "http://%s" % "/".join(address_parts)
+ interface['url'] = url
+ interface['urn'] = hrn_to_urn(hrn, 'authority')
+
+ self.interfaces = {}
+ required_fields = self.default_fields.keys()
+ for interface in interfaces:
+ valid = True
+ # skp any interface definition that has a null hrn,
+ # address or port
+ for field in required_fields:
+ if field not in interface or not interface[field]:
+ valid = False
+ break
+ if valid:
+ self.interfaces[interface['hrn']] = interface
+
+
+ def sync_interfaces(self):
+ """
+ Install missing trusted gids and db records for our federated
+ interfaces
+ """