no change - prettyfied
[sfa.git] / sfa / planetlab / plslices.py
index 73f2bc1..9c97113 100644 (file)
@@ -112,7 +112,8 @@ class PlSlices:
 
             # XXX Sanity check; though technically this should be a system invariant
             # checked with an assertion
-            if slice['expires'] > MAXINT:  slice['expires']= MAXINT
+            if slice['expires'] > MAXINT:
+                slice['expires'] = MAXINT
             
             slivers.append({
                 'hrn': hrn,
@@ -398,12 +399,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 +423,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,6 +446,7 @@ 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'])