|
|
|
@ -95,11 +95,6 @@ def register() :
|
|
|
|
|
plan = body['plan']
|
|
|
|
|
handler = Register(write=class_write,read=class_read,store=p,default=default_plan,uid=uid)
|
|
|
|
|
r = handler.register(plan)
|
|
|
|
|
if not r :
|
|
|
|
|
info = handler.get_info()
|
|
|
|
|
return "" if info is None else json.dumps(info)
|
|
|
|
|
else:
|
|
|
|
|
print r
|
|
|
|
|
return json.dumps(r)
|
|
|
|
|
|
|
|
|
|
def __register():
|
|
|
|
@ -154,7 +149,7 @@ def __register():
|
|
|
|
|
#@TODO : Initiate a retry
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
args = dict(p)
|
|
|
|
|
args = json.loads(json.dumps(p))
|
|
|
|
|
couchdb = factory.instance(type=class_read,args=args)
|
|
|
|
|
args['uid'] = r #-- returned uid
|
|
|
|
|
plan = couchdb.view('plans/active',key=r)
|
|
|
|
@ -164,7 +159,7 @@ def __register():
|
|
|
|
|
args['uid'] = body['uid']
|
|
|
|
|
couchdb = factory.instance(type=class_read,args=args)
|
|
|
|
|
document = couchdb.read()
|
|
|
|
|
print args,document
|
|
|
|
|
|
|
|
|
|
r = list(set(document['emails']) - set(body['uid']))
|
|
|
|
|
r = [item for item in r if len(item) == 36]
|
|
|
|
|
if len(r) > 0 :
|
|
|
|
@ -193,8 +188,9 @@ def get_nodes():
|
|
|
|
|
"""
|
|
|
|
|
r = []
|
|
|
|
|
try:
|
|
|
|
|
app_key = request.headers['key']
|
|
|
|
|
gReader = factory.instance(type=class_read,args=p)
|
|
|
|
|
r = gReader.view('summary/nodes',key=p['uid'])
|
|
|
|
|
r = gReader.view('summary/nodes',key=app_key)
|
|
|
|
|
session['default.node'] = r[0]
|
|
|
|
|
except Exception,e:
|
|
|
|
|
print (e)
|
|
|
|
@ -217,6 +213,37 @@ def get_apps():
|
|
|
|
|
print (e)
|
|
|
|
|
return json.dumps(r)
|
|
|
|
|
|
|
|
|
|
@app.route('/1/get/logs')
|
|
|
|
|
def get_logs() :
|
|
|
|
|
r = {}
|
|
|
|
|
#session['key'] = 'c259e8b1-e2fb-40df-bf03-f521f8ee352d'
|
|
|
|
|
key = session['key'] if 'key' in session else None
|
|
|
|
|
if key is None and 'key' in request.headers:
|
|
|
|
|
key = request.headers['key']
|
|
|
|
|
if key is None :
|
|
|
|
|
return json.dumps(r)
|
|
|
|
|
else:
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
|
gReader = factory.instance(type=class_read,args=p)
|
|
|
|
|
plan = gReader.view('plans/active',key=key)
|
|
|
|
|
|
|
|
|
|
if plan :
|
|
|
|
|
dbname = plan['name']
|
|
|
|
|
args = str(json.dumps(p))
|
|
|
|
|
args = json.loads(args)
|
|
|
|
|
args['dbname'] = dbname
|
|
|
|
|
scope = ['app_status','app_resources','folder_size','app_status_details']
|
|
|
|
|
for id in scope :
|
|
|
|
|
gReader = factory.instance(type=class_read,args=args)
|
|
|
|
|
view = ('summary/'+id).strip()
|
|
|
|
|
r[id] = gReader.view(view,key=key)
|
|
|
|
|
|
|
|
|
|
# r[id] = r[node_id]
|
|
|
|
|
|
|
|
|
|
except Exception,e:
|
|
|
|
|
print (e)
|
|
|
|
|
return json.dumps(r)
|
|
|
|
|
|
|
|
|
|
@app.route('/1/get/summary/<id>')
|
|
|
|
|
def get_summary(id):
|
|
|
|
|