"""
from sfa.util.faults import SliverDoesNotExist, UnknownSfaType
from sfa.util.sfalogging import logger
-from sfa.storage.alchemy import dbsession
from sfa.storage.model import RegRecord
from sfa.managers.driver import Driver
.. seealso::: Driver class
"""
- def __init__(self, config):
+ def __init__(self, api):
"""
Sets the iotlab SFA config parameters,
:type config: Config object
"""
- Driver.__init__(self, config)
- self.config = config
- self.testbed_shell = IotlabShell(config)
+ Driver.__init__(self, api)
+ self.api=api
+ config = api.config
+ self.testbed_shell = IotlabShell(api)
self.cache = None
def augment_records_with_testbed_info(self, record_list):
% (resources, res))
return result
- @staticmethod
- def get_user_record(hrn):
+ def get_user_record(self, hrn):
"""
Returns the user record based on the hrn from the SFA DB .
:rtype: RegUser
"""
- return dbsession.query(RegRecord).filter_by(hrn=hrn).first()
+ # xxx this method should not be static
+ from sfa.storage.alchemy import global_dbsession
+ return global_dbsession.query(RegRecord).filter_by(hrn=hrn).first()
+ # code should read instead (if this method was not static, that is)
+ #return self.api.dbsession().query(RegRecord).filter_by(hrn=hrn).first()
def testbed_name(self):
"""