Commit 27d3595b authored by Hamza Dely's avatar Hamza Dely

[config] En fait, on a besoin de gérer les différentes distributions

parent 03a5e3bb
......@@ -97,7 +97,19 @@ def connect_NK(request):
# On établit la connexion sur port 4242
sock.connect((settings.NK2015_IP, settings.NK2015_PORT))
# On passe en SSL
sock = ssl.wrap_socket(sock, ca_certs='../keys/ca_.crt')
# Le chemin versle certificat change en fonction de l'OS
if settings.DISTRIBUTION == 'debian' and settings.DIST_VERSION in [
"jessie",
"stretch",
"stretch/sid",
"sid",
"8.0",
"8.1",
]:
sock = ssl.wrap_socket(sock, ca_certs='keys/ca.crt')
else:
sock = ssl.wrap_socket(sock, ca_certs='../keys/ca_.crt')
# On fait un hello
sock.write(json.dumps(["hello", ["HTTP Django", ip_user]]))
# On récupère la réponse du hello
......
......@@ -9,6 +9,14 @@ DEV = (socket.gethostname() == "bde-test")
#: Est-on sur la note de prod ?
PROD = (socket.gethostname() == "bde2")
# Sur quel système la note tourne-t-elle ?
SYSTEM, NODE_NAME, KERNEL, KERNEL_VERSION, _, _ = platform.uname()
if SYSTEM == 'Linux':
DISTRIBUTION, DIST_VERSION, _ = platform.linux_distribution()
else:
DISTRIBUTION, DIST_VERSION = None, None
#: Charset par défaut
DEFAULT_CHARSET = "utf-8"
#: Mode de debug
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment