From 4c9734b25313f93c6277189bcf792151370c7225 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Fri, 22 Jun 2018 08:51:41 +0000
Subject: [PATCH] Added sending information of trisurf version to the server
---
tsclient.py | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/tsclient.py b/tsclient.py
index e658635..ba76880 100755
--- a/tsclient.py
+++ b/tsclient.py
@@ -10,6 +10,17 @@
import sys
import socket
from threading import Thread, Event
+import re
+
+def getTrisurfVersion():
+ p = subprocess.Popen('trisurf --version', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ lines=p.stdout.readlines()
+ version=re.findall(r'[0-9a-f]{7}(?:-dirty)?', lines[0].decode('ascii'))
+ p.wait()
+ if(len(version)):
+ return version[0]
+ else:
+ return "unknown version"
def get_hostname():
return socket.gethostname()
@@ -18,7 +29,7 @@
return ((([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")] or [[(s.connect(("8.8.8.8", 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) + ["no IP found"])[0])
def get_client_id(addr, my_ip, my_hostname, subrun):
- client_auth={'ip':my_ip,'hostname':my_hostname, 'subrun':subrun}
+ client_auth={'ip':my_ip,'hostname':my_hostname, 'subrun':subrun, 'trisurf_version':getTrisurfVersion() }
response=requests.post(addr+"/api/register/", data=client_auth)
if(response.status_code==200):
client_data=json.loads(response.text)
--
Gitblit v1.8.0