From 8058abbda761b70a9cad31df63fcde499713991c Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Wed, 27 Jun 2018 12:13:06 +0000
Subject: [PATCH] Fixed issue when subruns didn't report it's trisurf version

---
 tsclient.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tsclient.py b/tsclient.py
index ba76880..4d68b64 100755
--- a/tsclient.py
+++ b/tsclient.py
@@ -12,6 +12,10 @@
 from threading import Thread, Event
 import re
 
+
+
+glob_ts_version='00000'
+
 def getTrisurfVersion():
 	p = subprocess.Popen('trisurf --version', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 	lines=p.stdout.readlines()
@@ -29,7 +33,8 @@
 	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, 'trisurf_version':getTrisurfVersion() }
+	global glob_ts_version
+	client_auth={'ip':my_ip,'hostname':my_hostname, 'subrun':subrun, 'trisurf_version':glob_ts_version }
 	response=requests.post(addr+"/api/register/", data=client_auth)
 	if(response.status_code==200):
 		client_data=json.loads(response.text)
@@ -349,7 +354,8 @@
 #--- END SIGINT and SIGTERM----
 
 if __name__ == '__main__':
-
+	#global glob_ts_version
+	glob_ts_version=getTrisurfVersion()
 	signal.signal(signal.SIGINT, signal_handler)
 	signal.signal(signal.SIGTERM, signal_handler)
 

--
Gitblit v1.9.3