a few fixes in the comments for Sphinx.
authorSandrine Avakian <sandrine.avakian@inria.fr>
Wed, 4 Sep 2013 13:09:18 +0000 (15:09 +0200)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Mon, 16 Sep 2013 13:57:51 +0000 (15:57 +0200)
sfa/importer/iotlabimporter.py
sfa/iotlab/LDAPapi.py
sfa/iotlab/iotlabaggregate.py
sfa/iotlab/iotlabapi.py
sfa/iotlab/iotlabpostgres.py
sfa/iotlab/iotlabslices.py

index 3212de0..b95157a 100644 (file)
@@ -207,19 +207,21 @@ class IotlabImporter:
     def import_nodes(self, site_node_ids, nodes_by_id, iotlabdriver):
         """
 
-        Creates appropriate hostnames and RegNode records for
-        each node in site_node_ids, based on the information given by the
-        dict nodes_by_id that was made from data from OAR.
-        Saves the records to the DB.
+        Creates appropriate hostnames and RegNode records for each node in
+        site_node_ids, based on the information given by the dict nodes_by_id
+        that was made from data from OAR. Saves the records to the DB.
 
         :param site_node_ids: site's node ids
         :type site_node_ids: list of integers
         :param nodes_by_id: dictionary , key is the node id, value is the a dict
-        with node information.
+            with node information.
         :type nodes_by_id: dictionary
-        :param iotlabdriver:IotlabDriver object, used to have access to
+        :param iotlabdriver: IotlabDriver object, used to have access to
             iotlabdriver attributes.
-        :type iotlabdriver:IotlabDriver
+        :type iotlabdriver: IotlabDriver
+
+        :returns: None
+        :rtype: None
 
         """
 
@@ -321,9 +323,9 @@ class IotlabImporter:
         import the user's slice onto the database as well by calling
         import_slice.
 
-        :param iotlabdriver:IotlabDriver object, used to have access to
+        :param iotlabdriver: IotlabDriver object, used to have access to
             iotlabdriver attributes.
-        :type iotlabdriver:IotlabDriver
+        :type iotlabdriver: IotlabDriver
         """
         ldap_person_listdict = iotlabdriver.iotlab_api.GetPersons()
         self.logger.info("IOTLABIMPORT \t ldap_person_listdict %s \r\n"
index 254f994..15067ac 100644 (file)
@@ -1,13 +1,12 @@
 """
-This API is adapted for OpenLDAP.
-The file contains all LDAP classes and methods needed to:
- - Load the LDAP connection configuration file (login, address..) with
-    LdapConfig
- - Connect to LDAP with ldap_co
- - Create a unique LDAP login and password for a user based on his email or
-    last name and first name with LoginPassword.
- -  Manage entries in LDAP using SFA records with LDAPapi
- (Search, Add, Delete, Modify)
+This API is adapted for OpenLDAP. The file contains all LDAP classes and methods
+needed to:
+- Load the LDAP connection configuration file (login, address..) with LdapConfig
+- Connect to LDAP with ldap_co
+- Create a unique LDAP login and password for a user based on his email or last
+name and first name with LoginPassword.
+-  Manage entries in LDAP using SFA records with LDAPapi (Search, Add, Delete,
+Modify)
 
 """
 import random
@@ -116,11 +115,13 @@ class ldap_co:
         return {'bool': True}
 
     def close(self):
-        """ Close the LDAP connection.
+        """Close the LDAP connection.
 
         Can throw an exception if the unbinding fails.
-        :returns: dictionary with the bind status if fails.
-            False if not and in this case the error message({'bool','message'})
+
+        :returns: dictionary with the bind status if the unbinding failed and
+            in this case the dict contains an error message. The dictionary keys
+            are : ({'bool','message'})
         :rtype: dict or None
 
         """
@@ -335,6 +336,8 @@ class LoginPassword():
 class LDAPapi:
     """Defines functions to insert and search entries in the LDAP.
 
+    .. note:: class supposes the unix schema is used
+
     """
     def __init__(self):
         logger.setLevelDebug()
@@ -361,7 +364,7 @@ class LDAPapi:
         first name so that the user's login can be generated.
 
         :param record: Record must contain first_name and last_name.
-        :param record: dict
+        :type record: dict
         :returns: the generated login for the user described with record if the
             login generation is successful, None if it fails.
         :rtype: string or None
@@ -572,7 +575,7 @@ class LDAPapi:
         :param record: dictionnary with the user's data.
         :returns: a dictionary with the status (Fail= False, Success= True)
             and the uid of the newly added user if successful, or the error
-            meassage it is not. Dict has keys bool and message in case of
+            message it is not. Dict has keys bool and message in case of
             failure, and bool uid in case of success.
         :rtype: dict
 
index 6b31498..5164638 100644 (file)
@@ -333,22 +333,21 @@ class IotlabAggregate:
     def get_rspec(self, slice_xrn=None, login=None, version=None,
                   options=None):
         """
-
         Returns xml rspec:
-            - a full advertisement rspec with the testbed resources if slice_xrn
-             is not specified.If a lease option is given, also returns the
-             leases scheduled on the testbed.
-            - a manifest Rspec with the leases and nodes in slice's leases
-            if slice_xrn is not None.
+        - a full advertisement rspec with the testbed resources if slice_xrn is
+        not specified.If a lease option is given, also returns the leases
+        scheduled on the testbed.
+        - a manifest Rspec with the leases and nodes in slice's leases if
+        slice_xrn is not None.
 
         :param slice_xrn: srn of the slice
+        :type slice_xrn: string
         :param login: user'uid (ldap login) on iotlab
+        :type login: string
         :param version: can be set to sfa or iotlab
+        :type version: RSpecVersion
         :param options: used to specify if the leases should also be included in
             the returned rspec.
-        :type slice_xrn: string
-        :type login: string
-        :type version: RSpecVersion
         :type options: dict
 
         :returns: Xml Rspec.
index bbae92b..72bedfa 100644 (file)
@@ -69,8 +69,7 @@ class IotlabTestbedAPI():
 
         existing_records = {}
         existing_hrns_by_types = {}
-        logger.debug("IOTLAB_API \tGetPeers peer_filter %s, \
-                    " %(peer_filter))
+        logger.debug("IOTLAB_API \tGetPeers peer_filter %s " % (peer_filter))
         all_records = dbsession.query(RegRecord).filter(RegRecord.type.like('%authority%')).all()
 
         for record in all_records:
@@ -80,20 +79,20 @@ class IotlabTestbedAPI():
             else:
                 existing_hrns_by_types[record.type].append(record.hrn)
 
-
-        logger.debug("IOTLAB_API \tGetPeer\texisting_hrns_by_types %s "\
-                                             %( existing_hrns_by_types))
+        logger.debug("IOTLAB_API \tGetPeer\texisting_hrns_by_types %s "
+                     % (existing_hrns_by_types))
         records_list = []
 
         try:
             if peer_filter:
-                records_list.append(existing_records[(peer_filter,'authority')])
+                records_list.append(existing_records[(peer_filter,
+                                                     'authority')])
             else:
                 for hrn in existing_hrns_by_types['authority']:
-                    records_list.append(existing_records[(hrn,'authority')])
+                    records_list.append(existing_records[(hrn, 'authority')])
 
-            logger.debug("IOTLAB_API \tGetPeer \trecords_list  %s " \
-                                            %(records_list))
+            logger.debug("IOTLAB_API \tGetPeer \trecords_list  %s "
+                         (records_list))
 
         except KeyError:
             pass
@@ -112,10 +111,11 @@ class IotlabTestbedAPI():
         If a filter is specified, looks for the user whose properties match
         the filter, otherwise returns the whole enabled users'list.
 
-        :param person_filter: Must be a list of dictionnaries
-            with users properties when not set to None.
-        :param person_filter: list of dict
-        :returns:Returns a list of users whose accounts are enabled
+        :param person_filter: Must be a list of dictionnaries with users
+            properties when not set to None.
+        :type person_filter: list of dict
+
+        :returns: Returns a list of users whose accounts are enabled
             found in ldap.
         :rtype: list of dicts
 
index 70bc151..3c65278 100644 (file)
@@ -88,20 +88,21 @@ class IotlabDB(object):
             self.session()
 
         def create_iotlab_engine(self, config, debug=False):
-            """Creates the SQLAlchemy engine, which is the starting point
-            for any SQLAlchemy application.
+            """Creates the SQLAlchemy engine, which is the starting point for
+            any SQLAlchemy application.
             :param config: configuration object created by SFA based on the
-                configuration file in /etc
+            configuration file in /etc
             :param debug: if set to true, echo and echo pool will be set to true
-                as well. If echo is True, all statements as well as a repr()
-                of their parameter lists to the engines logger, which defaults
-                to sys.stdout. If echo_pool is True, the connection pool will
-                log all checkouts/checkins to the logging stream. A python
-                logger can be used to configure this logging directly but
-                so far it has not been configured. Refer to sql alchemy engine
-                documentation.
+            as well. If echo is True, all statements as well as a repr() of
+            their parameter lists to the engines logger, which defaults to
+            sys.stdout. If echo_pool is True, the connection pool will log all
+            checkouts/checkins to the logging stream. A python logger can be
+            used to configure this logging directly but so far it has not been
+            configured. Refer to sql alchemy engine documentation.
+
             :type config: Config instance (sfa.util.config)
             :type debug: bool
+
             """
 
             if debug is True:
@@ -182,8 +183,9 @@ class IotlabDB(object):
             :param  job_oar_list: list of job ids coming from OAR
             :type job_oar_list: list
             :param job_psql: list of job ids from the database.
-            type job_psql: list
+            :type job_psql: list
 
+            :returns: None
             """
             #Turn the list into a set
             set_jobs_psql = set(jobs_psql)
index d66d1e5..0fa6891 100644 (file)
@@ -350,7 +350,7 @@ class IotlabSlices:
 
         Checking that a user exist is based on the user's email. If the user is
         still not found in the LDAP, it means that the user comes from another
-        federated. In this case an account has to be created in LDAP
+        federated testbed. In this case an account has to be created in LDAP
         so as to enable the user to use the testbed, since we trust the testbed
         he comes from. This is done by calling AddPerson.