From 976f997dbfec09eb2d87599055d90dfda7a28234 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Mon, 3 Aug 2009 21:25:17 +0000 Subject: [PATCH] modified delete_record --- sfa/plc/sfaImport.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sfa/plc/sfaImport.py b/sfa/plc/sfaImport.py index e224d8da..c843272d 100644 --- a/sfa/plc/sfaImport.py +++ b/sfa/plc/sfaImport.py @@ -279,7 +279,24 @@ class sfaImport: except Exception, e: trace("Failed to import: %s (%s)" % (nodes[0], e)) - def delete_record(self, hrn, type = "*"): + def delete_record(self, parent_hrn, object, type): + # get the hrn + hrn = None + if type in ['slice'] and 'name' in object and object['name']: + slice_name = object['name'].split("_")[0] + hrn = parent_hrn + "." + slice_name + elif type in ['user', 'person'] and 'email' in object and object['email']: + person_name = object['email'].split('@')[0] + hrn = parent_hrn + "." + person_name + elif type in ['node'] and 'hostname' in object and object['hostname']: + node_name = object['hostname'].replace('.','_') + hrn = parent_hrn + "." + node_name + elif type in ['site'] and 'login_base' in object and object['login_base']: + site_name = object['login_base'] + hrn = parent_hrn + "." + site_name + else: + return + auth_name = self.get_auth_table(hrn) table = self.AuthHierarchy.get_auth_table(auth_name) record_list = table.resolve(type, hrn) -- 2.43.0