- if 'person_ids' in site:
- for person_id in site['person_ids']:
- persons = shell.GetPersons(plc_auth, [person_id])
- if persons:
- try:
- self.import_person(hrn, persons[0])
- except Exception, e:
- trace("Failed to import: %s (%s)" % (persons[0], e))
- if 'slice_ids' in site:
- for slice_id in site['slice_ids']:
- slices = shell.GetSlices(plc_auth, [slice_id])
- if slices:
- try:
- self.import_slice(hrn, slices[0])
- except Exception, e:
- trace("Failed to import: %s (%s)" % (slices[0], e))
- if 'node_ids' in site:
- for node_id in site['node_ids']:
- nodes = shell.GetNodes(plc_auth, [node_id])
- if nodes:
- try:
- self.import_node(hrn, nodes[0])
- except Exception, e:
- trace("Failed to import: %s (%s)" % (nodes[0], e))
-
- def delete_record(self, hrn, type = "*"):
- auth_name = self.get_auth_table(hrn)
- table = self.AuthHierarchy.get_auth_table(auth_name)
- record_list = table.resolve(type, hrn)
- if not record_list:
- return
- record = record_list[0]
- table.remove(record)
+ return hrn
+
+
+ def delete_record(self, hrn, type):
+ # delete the record
+ table = SfaTable()
+ record_list = table.find({'type': type, 'hrn': hrn})
+ for record in record_list:
+ trace("Import: Removing record %s %s" % (type, hrn), self.logger)
+ table.remove(record)