default_manifold_admin_password = 'demo'
default_myslice_theme = 'onelab'
+ #iotlab dev url
+ default_iotlab_url = "https://devgrenoble.senslab.info/rest/admin/users"
+ default_iotlab_admin_user = "auge"
+ default_iotlab_admin_password= "k,mfg1+Q"
def __init__ (self):
parser = RawConfigParser ()
from django.core.mail import EmailMultiAlternatives, send_mail
from myslice.theme import ThemeView
+from myslice.configengine import ConfigEngine
+
theme = ThemeView()
import time
from requests.auth import HTTPBasicAuth
- URL_REST = 'https://devgrenoble.senslab.info/rest/admin/users'
- LOGIN_ADMIN = "auge"
- PASSWORD_ADMIN = "k,mfg1+Q"
+ URL_REST = ConfigEngine.default_iotlab_url
+ LOGIN_ADMIN = ConfigEngine.default_iotlab_admin_user
+ PASSWORD_ADMIN = ConfigEngine.default_iotlab_admin_password
auth = HTTPBasicAuth(LOGIN_ADMIN,PASSWORD_ADMIN)
headers = {'content-type': 'application/json'}
from myslice.configengine import ConfigEngine
from myslice.theme import ThemeView
+from myslice.configengine import ConfigEngine
import urllib2,json
#get all iotlab users
try:
- userData = "Basic " + ('auge' + ":" + 'k,mfg1+Q').encode("base64").rstrip()
- req = urllib2.Request('https://devgrenoble.senslab.info/rest/admin/users')
+ userData = "Basic " + (ConfigEngine.default_iotlab_admin_user + ":" + ConfigEngine.default_iotlab_admin_password).encode("base64").rstrip()
+ req = urllib2.Request(ConfigEngine.default_iotlab_url)
req.add_header('Accept', 'application/json')
req.add_header("Content-type", "application/x-www-form-urlencoded")
req.add_header('Authorization', userData)
def servicesStatus(request):
Config = ConfigParser.ConfigParser()
- Config.read(os.getcwd() + "/myslice/monitor.ini")
+ Config.read(os.getcwd() + "/myslice/myslice/monitor.ini")
result = {}
cert = os.path.abspath(Config.get('monitor', 'cert'))
if not os.path.isfile(cert) :
- return HttpResponse(json.dumps({'error' : '-1'}), content_type="application/json")
+ return HttpResponse(json.dumps({'error' : '-2'}), content_type="application/json")
if not Config.has_option('monitor', 'pkey') :
- return HttpResponse(json.dumps({'error' : '-2'}), content_type="application/json")
+ return HttpResponse(json.dumps({'error' : '-3'}), content_type="application/json")
pkey = os.path.abspath(Config.get('monitor', 'pkey'))
if not os.path.isfile(pkey) :
- return HttpResponse(json.dumps({'error' : '-2'}), content_type="application/json")
+ return HttpResponse(json.dumps({'error' : '-4'}), content_type="application/json")
services = Config.sections()
for s in services :