X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=rest%2Fmonitor.py;h=d9a49391c35ca8c669b168598be56a677601808a;hb=refs%2Fheads%2Fonelab;hp=4372a3547fda1db056945fbc03ba623784e655b8;hpb=1757b94e83122aa5de77ebd935b7479b5a6e644e;p=myslice.git diff --git a/rest/monitor.py b/rest/monitor.py index 4372a354..d9a49391 100644 --- a/rest/monitor.py +++ b/rest/monitor.py @@ -7,7 +7,8 @@ import ConfigParser def servicesStatus(request): Config = ConfigParser.ConfigParser() - Config.read(os.getcwd() + "/myslice/monitor.ini") + monitor_file = os.path.abspath(os.path.dirname(__file__) + '/../myslice/monitor.ini') + Config.read(monitor_file) result = {} @@ -16,15 +17,15 @@ def servicesStatus(request): 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 :