|
@@ -135,10 +135,10 @@ def fetchDataADEI():
|
|
|
for chunk in image.iter_content():
|
|
|
handle.write(chunk)
|
|
|
|
|
|
- with open(".tmp.yaml", 'w') as stream_tmp:
|
|
|
+ with open("/tmp/.tmp.yaml", 'w') as stream_tmp:
|
|
|
stream_tmp.write(yaml.dump(cache_data, default_flow_style=False))
|
|
|
- src_file = os.getcwd() + "/.tmp.yaml"
|
|
|
- dst_file = os.getcwd() + "/cache.yaml"
|
|
|
+ src_file = "/tmp/.tmp.yaml"
|
|
|
+ dst_file = "/tmp/cache.yaml"
|
|
|
shutil.copy(src_file, dst_file)
|
|
|
|
|
|
|
|
@@ -149,7 +149,7 @@ class BaseHandler(tornado.web.RequestHandler):
|
|
|
|
|
|
class ListHandler(tornado.web.RequestHandler):
|
|
|
def get(self):
|
|
|
- with open("cache.yaml", 'r') as stream:
|
|
|
+ with open("/tmp/cache.yaml", 'r') as stream:
|
|
|
try:
|
|
|
response = yaml.load(stream)
|
|
|
except yaml.YAMLError as exc:
|
|
@@ -180,7 +180,7 @@ class SetTimerHandler(tornado.web.RequestHandler):
|
|
|
class DesignerHandler(tornado.web.RequestHandler):
|
|
|
def get(self):
|
|
|
print "In designer mode."
|
|
|
- with open("cache.yaml", 'r') as stream:
|
|
|
+ with open("/tmp/cache.yaml", 'r') as stream:
|
|
|
try:
|
|
|
cache_data = yaml.load(stream)
|
|
|
except yaml.YAMLError as exc:
|
|
@@ -258,7 +258,7 @@ class StatusHandler(tornado.web.RequestHandler):
|
|
|
except yaml.YAMLError as exc:
|
|
|
print(exc)
|
|
|
|
|
|
- with open("cache.yaml", 'r') as vstream:
|
|
|
+ with open("/tmp/cache.yaml", 'r') as vstream:
|
|
|
try:
|
|
|
cache_data = yaml.load(vstream)
|
|
|
except yaml.YAMLError as exc:
|
|
@@ -468,7 +468,7 @@ class AdeiKatrinHandler(tornado.web.RequestHandler):
|
|
|
|
|
|
class GetDataHandler(tornado.web.RequestHandler):
|
|
|
def get(self):
|
|
|
- with open("cache.yaml", 'r') as stream:
|
|
|
+ with open("/tmp/cache.yaml", 'r') as stream:
|
|
|
try:
|
|
|
cache_data = yaml.load(stream)
|
|
|
except yaml.YAMLError as exc:
|
|
@@ -500,7 +500,7 @@ class AuthLoginHandler(BaseHandler):
|
|
|
if auth:
|
|
|
self.set_current_user(username)
|
|
|
print "In designer mode."
|
|
|
- with open("cache.yaml", 'r') as stream:
|
|
|
+ with open("/tmp/cache.yaml", 'r') as stream:
|
|
|
try:
|
|
|
cache_data = yaml.load(stream)
|
|
|
except yaml.YAMLError as exc:
|
|
@@ -544,19 +544,20 @@ rt = RepeatedTimer(int(config["polling"]), fetchDataADEI)
|
|
|
|
|
|
application = tornado.web.Application([
|
|
|
(r"/auth/login/?", AuthLoginHandler),
|
|
|
- (r"/"+config['title'].lower()+"/version/?", VersionHandler),
|
|
|
- (r"/"+config['title'].lower()+"/list/?", ListHandler),
|
|
|
- (r"/"+config['title'].lower()+"/start/?", StartHandler),
|
|
|
- (r"/"+config['title'].lower()+"/backup/?", BackupHandler),
|
|
|
- (r"/"+config['title'].lower()+"/stop/?", StopHandler),
|
|
|
- (r"/"+config['title'].lower()+"/designer/?", DesignerHandler),
|
|
|
- (r"/"+config['title'].lower()+"/status/?", StatusHandler),
|
|
|
- (r"/"+config['title'].lower()+"/save/?", SaveHandler),
|
|
|
- (r"/"+config['title'].lower()+"/update/?", UpdateHandler),
|
|
|
- (r"/"+config['title'].lower()+"/getdata/?", GetDataHandler),
|
|
|
- (r"/"+config['title'].lower()+"/timer/(?P<duration>[^\/]+)/?",
|
|
|
+ (r"/version/?", VersionHandler),
|
|
|
+ (r"/list/?", ListHandler),
|
|
|
+ (r"/start/?", StartHandler),
|
|
|
+ (r"/backup/?", BackupHandler),
|
|
|
+ (r"/stop/?", StopHandler),
|
|
|
+ (r"/designer/?", DesignerHandler),
|
|
|
+ (r"/", StatusHandler),
|
|
|
+ (r"/status/?", StatusHandler),
|
|
|
+ (r"/save/?", SaveHandler),
|
|
|
+ (r"/update/?", UpdateHandler),
|
|
|
+ (r"/getdata/?", GetDataHandler),
|
|
|
+ (r"/timer/(?P<duration>[^\/]+)/?",
|
|
|
SetTimerHandler),
|
|
|
- (r"/"+config['title'].lower()+"/add/(?P<db_server>[^\/]+)/?"
|
|
|
+ (r"/add/(?P<db_server>[^\/]+)/?"
|
|
|
"(?P<db_name>[^\/]+)/?(?P<db_group>[^\/]+)/?(?P<sensor_name>[^\/]+)?",
|
|
|
AdeiKatrinHandler)
|
|
|
], debug=True, static_path=os.path.join(root, 'static'),
|