import ldap
from sfa.util.config import Config
from sfa.trust.hierarchy import Hierarchy
-#from sfa.trust.certificate import *
+
import ldap.modlist as modlist
from sfa.util.sfalogging import logger
import os.path
class LdapConfig():
def __init__(self, config_file = '/etc/sfa/ldap_config.py'):
+
try:
execfile(config_file, self.__dict__)
"""
#Keep consistency with Java Senslab's LDAP API
#RFC2307SSHAPasswordEncryptor so set the salt size to 8 bytres
- return lssha.encrypt(password,salt_size = 8)
+ return lssha.encrypt(password, salt_size = 8)
#If the user wants to set his own password , he must go to the Senslab
#website.
password = self.generate_password()
- attrs['userPassword']= self.encrypt_password(password)
+ attrs['userPassword'] = self.encrypt_password(password)
#Account automatically validated (no mail request to admins)
#Set to 0 to disable the account, -1 to enable it,
import json
#import datetime
#from time import gmtime, strftime
-
+import os.path
#import urllib
#import urllib2
from sfa.util.config import Config
from sfa.util.sfalogging import logger
-
OARIP = '194.199.16.166'
+
OAR_REQUEST_POST_URI_DICT = {'POST_job':{'uri': '/oarapi/jobs.json'},
'DELETE_jobs_id':{'uri':'/oarapi/jobs/id.json'},
}
class OARrestapi:
- def __init__(self):
+ def __init__(self, config_file = '/etc/sfa/oar_config.py'):
self.oarserver = {}
- self.oarserver['ip'] = OARIP
- self.oarserver['port'] = 8800
+
+
self.oarserver['uri'] = None
self.oarserver['postformat'] = 'json'
+
+ try:
+ execfile(config_file, self.__dict__)
+
+ self.config_file = config_file
+ # path to configuration data
+ self.config_path = os.path.dirname(config_file)
+
+ except IOError:
+ raise IOError, "Could not find or load the configuration file: %s" \
+ % config_file
#logger.setLevelDebug()
-
+ self.oarserver['ip'] = self.OAR_IP
+ self.oarserver['port'] = self.OAR_PORT
self.jobstates = ['Terminated', 'Hold', 'Waiting', 'toLaunch', \
'toError', 'toAckReservation', 'Launching', \
'Finishing', 'Running', 'Suspended', 'Resuming',\
# sudo cp $git_local_repo/sfa/senslab/config/$vm/site_config /etc/sfa/configs/site_config
# sudo ln -s ldap_config.py /etc/sfa/ldap_config.py
sudo cp $git_local_repo/sfa/senslab/config/ldap_config.py /etc/sfa/ldap_config.py
+sudo cp $git_local_repo/sfa/senslab/config/oar_config.py /etc/sfa/oar_config.py
sudo service sfa restart
# User stuff : clean your folder