AuthHierarchy = self.AuthHierarchy
auth_info = AuthHierarchy.get_auth_info(auth_name)
- table = GeniTable(hrn=auth_name,
- cninfo=auth_info.get_dbinfo())
+ table = GeniTable(cninfo=auth_info.get_dbinfo())
# if the table doesn't exist, then it means we haven't put any records
# into this authority yet.
# get the user's private key from the SSH keys they have uploaded
# to planetlab
- keys = shell.GetKeys(plc_auth, key_ids)
+ keys = self.shell.GetKeys(self.plc_auth, key_ids)
key = keys[0]['key']
pkey = convert_public_key(key)
else:
def import_node(self, parent_hrn, node):
AuthHierarchy = self.AuthHierarchy
- nodename = node['hostname'].split(".")[0]
+ nodename = node['hostname'].replace(".", "_")
nodename = cleanup_string(nodename)
if not nodename:
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)
+ 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
+
+ table = self.get_auth_table(parent_hrn)
record_list = table.resolve(type, hrn)
if not record_list:
return