添加新接口
This commit is contained in:
parent
3717a9f46f
commit
59ab207f92
|
@ -9,7 +9,6 @@ from flask import Flask, request
|
|||
# must first init loadenv
|
||||
import tools, env
|
||||
# default CONFIG=/opt/docklet/local/docklet-running.conf
|
||||
from notificationmgr import NotificationMgr
|
||||
|
||||
config = env.getenv("CONFIG")
|
||||
tools.loadenv(config)
|
||||
|
@ -23,7 +22,7 @@ from log import logger
|
|||
import os
|
||||
import http.server, cgi, json, sys, shutil
|
||||
from socketserver import ThreadingMixIn
|
||||
import nodemgr, vclustermgr, etcdlib, network, imagemgr
|
||||
import nodemgr, vclustermgr, etcdlib, network, imagemgr, notificationmgr
|
||||
import userManager
|
||||
import monitor,traceback
|
||||
import threading
|
||||
|
@ -781,7 +780,7 @@ if __name__ == '__main__':
|
|||
etcdclient.deldir("_lock")
|
||||
|
||||
G_usermgr = userManager.userManager('root')
|
||||
G_notificationmgr = NotificationMgr()
|
||||
G_notificationmgr = notificationmgr.NotificationMgr()
|
||||
|
||||
clusternet = env.getenv("CLUSTER_NET")
|
||||
logger.info("using CLUSTER_NET %s" % clusternet)
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
from log import logger
|
||||
from model import db, Notification, NotificationGroups
|
||||
from userManager import administration_required
|
||||
|
||||
|
||||
class NotificationMgr:
|
||||
def __init__(self):
|
||||
logger.info("Notification Manager init...")
|
||||
try:
|
||||
Notification.query.all()
|
||||
except:
|
||||
db.create_all()
|
||||
try:
|
||||
NotificationGroups.query.all()
|
||||
except:
|
||||
db.create_all()
|
||||
logger.info("Notification Manager init done!")
|
||||
|
||||
@administration_required
|
||||
def create_notification(self, *args, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue