From b62ad85f54c7b9805195597f31124fff52374af5 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 17 Jan 2012 16:02:40 +0100 Subject: [PATCH] Added return email and firstname/lastname in LDAP when calling ldapfind. Added DEPLOY option when creating a job on OAR (missing firmware=>error). Fixed show option bug with sfi.py. --- sfa/senslab/LDAPapi.py | 6 ++--- sfa/senslab/slabdriver.py | 49 +++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/sfa/senslab/LDAPapi.py b/sfa/senslab/LDAPapi.py index d84f6f8b..ec3cf1ba 100644 --- a/sfa/senslab/LDAPapi.py +++ b/sfa/senslab/LDAPapi.py @@ -84,9 +84,9 @@ class LDAPapi : 'type': 'user', 'pkey': ldapentry[1]['sshPublicKey'][0], 'uid': ldapentry[1]['uid'][0], -# 'email': ldapentry[1]['mail'][0], -# 'first_name': ldapentry[1]['givenName'][0], -# 'last_name': ldapentry[1]['sn'][0], + 'email': ldapentry[1]['mail'][0], + 'first_name': ldapentry[1]['givenName'][0], + 'last_name': ldapentry[1]['sn'][0], # 'phone': 'none', 'serial': 'none', 'authority': self.authname, diff --git a/sfa/senslab/slabdriver.py b/sfa/senslab/slabdriver.py index 1d6ded8b..8f0bde79 100644 --- a/sfa/senslab/slabdriver.py +++ b/sfa/senslab/slabdriver.py @@ -527,7 +527,7 @@ class SlabDriver(Driver): reqdict['resource'] ="network_address="+ str(len(nodeid_list)) reqdict['resource']+= ",walltime=" + str(00) + ":" + str(05) + ":" + str(00) reqdict['script_path'] = "/bin/sleep 320" - #reqdict['type'] = "deploy" + reqdict['type'] = "deploy" print>>sys.stderr, "\r\n \r\n AddSliceToNodes reqdict %s \r\n site_list %s" %(reqdict,site_list) OAR = OARrestapi() answer = OAR.POSTRequestToOARRestAPI('POST_job',reqdict,slice_user) @@ -666,31 +666,34 @@ class SlabDriver(Driver): Given a SFA record, fill in the senslab specific and SFA specific fields in the record. """ - print >>sys.stderr, "\r\n \t\t BEFORE fill_record_pl_info %s" %(records) + print >>sys.stderr, "\r\n \t\t BEFORE fill_record_info %s" %(records) if isinstance(records, list): - records = records[0] + records = [records] #print >>sys.stderr, "\r\n \t\t BEFORE fill_record_pl_info %s" %(records) - - if records['type'] == 'slice': - - sfatable = SfaTable() - recslice = self.db.find('slice',str(records['hrn'])) - if isinstance(recslice,list) and len(recslice) == 1: - recslice = recslice[0] - recuser = sfatable.find( recslice['record_id_user'], ['hrn']) - - print >>sys.stderr, "\r\n \t\t SLABDRIVER.PY fill_record_info %s" %(recuser) - records['type'] - if isinstance(recuser,list) and len(recuser) == 1: - recuser = recuser[0] - records.update({'PI':[recuser['hrn']], - 'researcher': [recuser['hrn']], - 'name':records['hrn'], 'oar_job_id':recslice['oar_job_id'], - - 'node_ids': [], - 'person_ids':[recslice['record_id_user']]}) - + try: + if records['type'] == 'slice': + + sfatable = SfaTable() + recslice = self.db.find('slice',str(records['hrn'])) + if isinstance(recslice,list) and len(recslice) == 1: + recslice = recslice[0] + recuser = sfatable.find( recslice['record_id_user'], ['hrn']) + + print >>sys.stderr, "\r\n \t\t SLABDRIVER.PY fill_record_info %s" %(recuser) + records['type'] + if isinstance(recuser,list) and len(recuser) == 1: + recuser = recuser[0] + records.update({'PI':[recuser['hrn']], + 'researcher': [recuser['hrn']], + 'name':records['hrn'], 'oar_job_id':recslice['oar_job_id'], + + 'node_ids': [], + 'person_ids':[recslice['record_id_user']]}) + except TypeError: + print >>sys.stderr, "\r\n \t\t SLABDRIVER fill_record_info EXCEPTION RECORDS : %s" %(records) + return + #self.fill_record_pl_info(records) ##print >>sys.stderr, "\r\n \t\t after fill_record_pl_info %s" %(records) #self.fill_record_sfa_info(records) -- 2.47.0