+
+
+#TODO FUNCTIONS SECTION 04/07/2012 SA
+
+ #TODO : Is UnBindObjectFromPeer still necessary ? Currently does nothing
+ #04/07/2012 SA
+ def UnBindObjectFromPeer(self, auth, object_type, object_id, shortname):
+ """ This method is a hopefully temporary hack to let the sfa correctly
+ detach the objects it creates from a remote peer object. This is
+ needed so that the sfa federation link can work in parallel with
+ RefreshPeer, as RefreshPeer depends on remote objects being correctly
+ marked.
+ Parameters:
+ auth : struct, API authentication structure
+ AuthMethod : string, Authentication method to use
+ object_type : string, Object type, among 'site','person','slice',
+ 'node','key'
+ object_id : int, object_id
+ shortname : string, peer shortname
+ FROM PLC DOC
+
+ """
+ logger.warning("SLABDRIVER \tUnBindObjectFromPeer EMPTY-\
+ DO NOTHING \r\n ")
+ return
+
+ #TODO Is BindObjectToPeer still necessary ? Currently does nothing
+ #04/07/2012 SA
+ def BindObjectToPeer(self, auth, object_type, object_id, shortname=None, \
+ remote_object_id=None):
+ """This method is a hopefully temporary hack to let the sfa correctly
+ attach the objects it creates to a remote peer object. This is needed
+ so that the sfa federation link can work in parallel with RefreshPeer,
+ as RefreshPeer depends on remote objects being correctly marked.
+ Parameters:
+ shortname : string, peer shortname
+ remote_object_id : int, remote object_id, set to 0 if unknown
+ FROM PLC API DOC
+
+ """
+ logger.warning("SLABDRIVER \tBindObjectToPeer EMPTY - DO NOTHING \r\n ")
+ return
+
+ #TODO UpdateSlice 04/07/2012 SA
+ #Funciton should delete and create another job since oin senslab slice=job
+ def UpdateSlice(self, auth, slice_id_or_name, slice_fields=None):
+ """Updates the parameters of an existing slice with the values in
+ slice_fields.
+ Users may only update slices of which they are members.
+ PIs may update any of the slices at their sites, or any slices of
+ which they are members. Admins may update any slice.
+ Only PIs and admins may update max_nodes. Slices cannot be renewed
+ (by updating the expires parameter) more than 8 weeks into the future.
+ Returns 1 if successful, faults otherwise.
+ FROM PLC API DOC
+
+ """
+ logger.warning("SLABDRIVER UpdateSlice EMPTY - DO NOTHING \r\n ")
+ return
+
+ #TODO UpdatePerson 04/07/2012 SA
+ def UpdatePerson(self, auth, person_id_or_email, person_fields=None):
+ """Updates a person. Only the fields specified in person_fields
+ are updated, all other fields are left untouched.
+ Users and techs can only update themselves. PIs can only update
+ themselves and other non-PIs at their sites.
+ Returns 1 if successful, faults otherwise.
+ FROM PLC API DOC
+
+ """
+ logger.warning("SLABDRIVER UpdatePerson EMPTY - DO NOTHING \r\n ")
+ return
+
+ #TODO GetKeys 04/07/2012 SA
+ def GetKeys(self, auth, key_filter=None, return_fields=None):
+ """Returns an array of structs containing details about keys.
+ If key_filter is specified and is an array of key identifiers,
+ or a struct of key attributes, only keys matching the filter
+ will be returned. If return_fields is specified, only the
+ specified details will be returned.
+
+ Admin may query all keys. Non-admins may only query their own keys.
+ FROM PLC API DOC
+
+ """
+ logger.warning("SLABDRIVER GetKeys EMPTY - DO NOTHING \r\n ")
+ return
+
+ #TODO DeleteKey 04/07/2012 SA
+ def DeleteKey(self, auth, key_id):
+ """ Deletes a key.
+ Non-admins may only delete their own keys.
+ Returns 1 if successful, faults otherwise.
+ FROM PLC API DOC
+
+ """
+ logger.warning("SLABDRIVER DeleteKey EMPTY - DO NOTHING \r\n ")
+ return
+
+
+ #TODO : Check rights to delete person
+ def DeletePerson(self, auth, person_record):
+ """ Disable an existing account in senslab LDAP.
+ Users and techs can only delete themselves. PIs can only
+ delete themselves and other non-PIs at their sites.
+ ins can delete anyone.
+ Returns 1 if successful, faults otherwise.
+ FROM PLC API DOC
+
+ """
+ #Disable user account in senslab LDAP
+ ret = self.ldap.LdapMarkUserAsDeleted(person_record)
+ logger.warning("SLABDRIVER DeletePerson %s " %(person_record))
+ return ret
+
+ #TODO Check DeleteSlice, check rights 05/07/2012 SA
+ def DeleteSlice(self, auth, slice_record):
+ """ Deletes the specified slice.
+ Senslab : Kill the job associated with the slice if there is one
+ using DeleteSliceFromNodes.
+ Updates the slice record in slab db to remove the slice nodes.
+
+ Users may only delete slices of which they are members. PIs may
+ delete any of the slices at their sites, or any slices of which
+ they are members. Admins may delete any slice.
+ Returns 1 if successful, faults otherwise.
+ FROM PLC API DOC
+
+ """
+ self.DeleteSliceFromNodes(slice_record)
+ logger.warning("SLABDRIVER DeleteSlice %s "%(slice_record))
+ return
+
+ #TODO AddPerson 04/07/2012 SA
+ def AddPerson(self, auth, person_fields=None):
+ """Adds a new account. Any fields specified in person_fields are used,
+ otherwise defaults are used.
+ Accounts are disabled by default. To enable an account,
+ use UpdatePerson().
+ Returns the new person_id (> 0) if successful, faults otherwise.
+ FROM PLC API DOC
+
+ """
+ logger.warning("SLABDRIVER AddPerson EMPTY - DO NOTHING \r\n ")
+ return
+
+ #TODO AddPersonToSite 04/07/2012 SA
+ def AddPersonToSite (self, auth, person_id_or_email, \
+ site_id_or_login_base=None):
+ """ Adds the specified person to the specified site. If the person is
+ already a member of the site, no errors are returned. Does not change
+ the person's primary site.
+ Returns 1 if successful, faults otherwise.
+ FROM PLC API DOC
+
+ """
+ logger.warning("SLABDRIVER AddPersonToSite EMPTY - DO NOTHING \r\n ")
+ return
+
+ #TODO AddRoleToPerson : Not sure if needed in senslab 04/07/2012 SA
+ def AddRoleToPerson(self, auth, role_id_or_name, person_id_or_email):
+ """Grants the specified role to the person.
+ PIs can only grant the tech and user roles to users and techs at their
+ sites. Admins can grant any role to any user.
+ Returns 1 if successful, faults otherwise.
+ FROM PLC API DOC
+
+ """
+ logger.warning("SLABDRIVER AddRoleToPerson EMPTY - DO NOTHING \r\n ")
+ return
+
+ #TODO AddPersonKey 04/07/2012 SA
+ def AddPersonKey(self, auth, person_id_or_email, key_fields=None):
+ """Adds a new key to the specified account.
+ Non-admins can only modify their own keys.
+ Returns the new key_id (> 0) if successful, faults otherwise.
+ FROM PLC API DOC
+
+ """
+ logger.warning("SLABDRIVER AddPersonKey EMPTY - DO NOTHING \r\n ")
+ return
+
+ def DeleteLeases(self, leases_id_list, slice_hrn ):
+ for job_id in leases_id_list:
+ self.DeleteJobs(job_id, slice_hrn)
+
+ logger.debug("SLABDRIVER DeleteLeases leases_id_list %s slice_hrn %s \r\n " %(leases_id_list, slice_hrn))
+ return