Removed unused import from planetlab.plxrn in slab files.
[sfa.git] / sfa / senslab / slabdriver.py
index 349873e..555cd0f 100644 (file)
@@ -18,7 +18,7 @@ from sfa.rspecs.version_manager import VersionManager
 from sfa.rspecs.rspec import RSpec
 
 from sfa.util.xrn import hrn_to_urn, urn_to_sliver_id, get_leaf
-from sfa.planetlab.plxrn import slicename_to_hrn, hrn_to_pl_slicename, \
+from sfa.planetlab.plxrn import slicename_to_hrn, \
                                         hostname_to_urn, \
                                         xrn_to_hostname
 
@@ -266,7 +266,6 @@ class SlabDriver(Driver):
                 #return rspec 
     
         #panos: passing user-defined options
-        logger.debug("SLABDRIVER \tlist_resources rspec " )
         aggregate = SlabAggregate(self)
         origin_hrn = Credential(string=creds[0]).get_gid_caller().get_hrn()
         options.update({'origin_hrn':origin_hrn})
@@ -537,8 +536,8 @@ class SlabDriver(Driver):
        
         answer = self.oar.POSTRequestToOARRestAPI('DELETE_jobs_id', \
                                                     reqdict,username)
-        logger.debug("SLABDRIVER \tDeleteJobs jobid  %s \r\n answer %s "  \
-                                                %(job_id,answer))
+        logger.debug("SLABDRIVER \tDeleteJobs jobid  %s \r\n answer %s username %s"  \
+                                                %(job_id,answer, username))
         return answer
 
             
@@ -858,10 +857,11 @@ class SlabDriver(Driver):
             #instantion used in get_slivers ? 
             if not "instantiation" in slab_record:
                 slab_record["instantiation"] = "senslab-instantiated"
-            slab_record["hrn"] = hrn_to_pl_slicename(hrn)
+            #slab_record["hrn"] = hrn_to_pl_slicename(hrn)     
+            #Unused hrn_to_pl_slicename because Slab's hrn already in the appropriate form SA 23/07/12
+            slab_record["hrn"] = hrn 
             logger.debug("SLABDRIVER.PY sfa_fields_to_slab_fields \
-                        slab_record %s hrn_to_pl_slicename(hrn) hrn %s " \
-                                                %(slab_record['hrn'], hrn))
+                        slab_record %s  " %(slab_record['hrn']))
             if "url" in record:
                 slab_record["url"] = record["url"]
             if "description" in record:
@@ -1131,8 +1131,11 @@ class SlabDriver(Driver):
 
             user = dbsession.query(RegUser).filter_by(email = \
                                                 ldap_info['mail'][0]).first()
-           
-            slice_info = slab_dbsession.query(SliceSenslab).filter_by(record_id_user = user.record_id).first()
+            #Separated in case user not in database : record_id not defined SA 17/07//12
+            query_slice_info = slab_dbsession.query(SliceSenslab).filter_by(record_id_user = user.record_id)
+            if query_slice_info:
+                slice_info = query_slice_info.first()
+                
             #Put the slice_urn 
             resa['slice_id'] = hrn_to_urn(slice_info.slice_hrn, 'slice')
             resa['component_id_list'] = []