changement d'utilisation de l'IPC sock
This commit is contained in:
@@ -24,7 +24,7 @@ import shutil
|
||||
import hashlib
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
from ConfBack.manager import sock
|
||||
from ConfBack.manager import Sock
|
||||
|
||||
#########################################################
|
||||
# Class et Methods #
|
||||
@@ -136,14 +136,19 @@ def update_params():
|
||||
with open(current_app.config['DB_PATH'], 'w') as f:
|
||||
json.dump(data, f)
|
||||
|
||||
try:
|
||||
# send order to KineIntercom process
|
||||
sock.send(b"RELOAD_DB\n")
|
||||
except:
|
||||
current_app.logger.error("Erreur d'envoi de l'ordre au processus KineIntercom")
|
||||
abort(status.HTTP_406_NOT_ACCEPTABLE, description="Erreur d'envoi de l'ordre au processus")
|
||||
conn = Sock(addr=current_app.config['UNIX_ADDR'], logger=current_app.logger)
|
||||
if not conn.connect():
|
||||
current_app.logger.error("impossible de se connecter au serveur")
|
||||
abort(status.HTTP_406_NOT_ACCEPTABLE, description="Impossible de se connecter au serveur")
|
||||
|
||||
# send order to KineIntercom process
|
||||
if not conn.send(b"RELOAD_DB\n"):
|
||||
conn.disconnect()
|
||||
current_app.logger.error("impossible de communiquer avec le serveur")
|
||||
abort(status.HTTP_406_NOT_ACCEPTABLE, description="Impossible de communiquer avec le serveur")
|
||||
|
||||
conn.disconnect()
|
||||
|
||||
content = {'message':'maj parameters successful!'}
|
||||
|
||||
return content, status.HTTP_200_OK
|
||||
|
||||
|
||||
Reference in New Issue
Block a user