move api index and apache_restart
This commit is contained in:
0
app/api/__init__.py
Normal file
0
app/api/__init__.py
Normal file
29
app/api/apache_restart.py
Normal file
29
app/api/apache_restart.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
from flask_restful import Resource, abort
|
||||
|
||||
from app.glob import get_config
|
||||
|
||||
apache_restart_flagfile = 'restart_apache'
|
||||
|
||||
|
||||
class ApacheRestartFlag(Resource):
|
||||
def get(self):
|
||||
cfg = get_config()
|
||||
flagfile = cfg.get('apache_restart_flagfile', apache_restart_flagfile)
|
||||
if not os.path.isfile(flagfile):
|
||||
abort(404, message='not found')
|
||||
return {
|
||||
'message': 'found'
|
||||
}
|
||||
|
||||
def put(self):
|
||||
cfg = get_config()
|
||||
flagfile = cfg.get('apache_restart_flagfile', apache_restart_flagfile)
|
||||
if os.path.isfile(flagfile):
|
||||
return '', 304
|
||||
with open(flagfile, 'a'):
|
||||
pass
|
||||
return {
|
||||
'message': 'success'
|
||||
}
|
7
app/api/index.py
Normal file
7
app/api/index.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from flask_restful import Resource
|
||||
|
||||
|
||||
class APIIndex(Resource):
|
||||
def get(self):
|
||||
return ['infobases-available', 'infobases-all', 'publications',
|
||||
'module', 'config', 'config-test', 'apache-restart']
|
Reference in New Issue
Block a user