X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fplanetlab%2Fplslices.py;h=decb54646cf374aa187243a29ef8c16d86e29ebf;hb=866350aac4c72675b8dd6c0b8b5b0673470d1dea;hp=46dbb23b370d1db888b1850e4a049185fabeca2a;hpb=432cca980c7eed80284776f05566cf628088f7aa;p=sfa.git diff --git a/sfa/planetlab/plslices.py b/sfa/planetlab/plslices.py index 46dbb23b..decb5464 100644 --- a/sfa/planetlab/plslices.py +++ b/sfa/planetlab/plslices.py @@ -398,12 +398,15 @@ class PlSlices: 'description': description, 'hrn': slice_hrn, 'sfa_created': 'True', - 'expires': expires, + #'expires': expires, } # add the slice slice_id = self.driver.shell.AddSlice(slice) # plcapi tends to mess with the incoming hrn so let's make sure self.driver.shell.SetSliceHrn (slice_id, slice_hrn) + # cannot be set with AddSlice + # set the expiration + self.driver.shell.UpdateSlice(slice_id, {'expires': expires}) return self.driver.shell.GetSlices(slice_id)[0] @@ -419,6 +422,8 @@ class PlSlices: # the value to use if 'user' has no 'email' attached - or if the attached email already exists # typically ( auth_hrn, _ , leaf ) = user_hrn.rpartition('.') + # somehow this has backslashes, get rid of them + auth_hrn = auth_hrn.replace('\\','') default_email = "%s@%s.stub"%(leaf,auth_hrn) person_record = { @@ -440,14 +445,17 @@ class PlSlices: # so we first try with the accurate email person_id = int (self.driver.shell.AddPerson(person_record)) except: + logger.log_exc("caught during first attempt at AddPerson") + # and if that fails we start again with the email based on the hrn, which this time is unique.. person_record['email']=default_email logger.debug ("second chance with email=%s"%person_record['email']) - # and if that fails we start again with the email based on the hrn, which this time is unique.. person_id = int (self.driver.shell.AddPerson(person_record)) self.driver.shell.AddRoleToPerson('user', person_id) self.driver.shell.AddPersonToSite(person_id, site_id) # plcapi tends to mess with the incoming hrn so let's make sure self.driver.shell.SetPersonHrn (person_id, user_hrn) + # also 'enabled':True does not seem to pass through with AddPerson + self.driver.shell.UpdatePerson (person_id, {'enabled': True}) return person_id