summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2014-01-14 00:20:11 +0100
committermakefu <github@syntax-fehler.de>2014-01-14 00:20:11 +0100
commit83f27b39a2df428e5de137a02014858ae44b4f80 (patch)
treed7bec4d936c33851d5e4bad6c2d1e9de9711d43b /retiolum/scripts
parent50c2347e32640b8472b4b100466576979f72eec9 (diff)
tinc_stats: remove legacy code from Log2JSON
Diffstat (limited to 'retiolum/scripts')
-rwxr-xr-xretiolum/scripts/adv_graphgen/tinc_stats/Log2JSON.py42
1 files changed, 1 insertions, 41 deletions
diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Log2JSON.py b/retiolum/scripts/adv_graphgen/tinc_stats/Log2JSON.py
index 644cbc63..adc869fb 100755
--- a/retiolum/scripts/adv_graphgen/tinc_stats/Log2JSON.py
+++ b/retiolum/scripts/adv_graphgen/tinc_stats/Log2JSON.py
@@ -57,12 +57,6 @@ def parse_tinc_stats():
elif which("tincctl"):
return parse_new_input("tincctl")
#old tinc
- elif which("tincd"):
- # TODO refactor me
- subprocess.call(["pkill","-SIGUSR2", "tincd"])
- sleep(1)
- return parse_input(get_tinc_block(get_tinc_log_file()))
- #no tinc
else:
raise Exception("no tinc executable found!")
@@ -124,43 +118,9 @@ def parse_new_input(tinc_bin):
pass #node does not exist
return nodes
-#@debug
-def parse_input(log_data):
- nodes={}
- for line in log_data:
- if BEGIN_NODES in line :
- nodes={}
- for line in log_data:
- if END_NODES in line :
- break
- l = line.replace('\n','').split() #TODO unhack me
- nodes[l[0]]= { 'external-ip': l[2], 'external-port' : l[4] }
- if BEGIN_SUBNET in line :
- for line in log_data:
- if END_SUBNET in line :
- break
- l = line.replace('\n','').split()
- if not nodes[l[2]].get('internal-ip',False):
- nodes[l[2]]['internal-ip'] = []
- nodes[l[2]]['internal-ip'].append(l[0].split('#')[0])
- if BEGIN_EDGES in line :
- edges = {}
- for line in log_data:
- if END_EDGES in line :
- break
- l = line.replace('\n','').split()
- if not nodes[l[0]].has_key('to') :
- nodes[l[0]]['to'] = []
- nodes[l[0]]['to'].append(
- {'name':l[2],'addr':l[4],'port':l[6],'weight' : l[10] })
- return nodes
-
-
if __name__ == '__main__':
- # TODO refactor me
from sys import argv
if len(argv) > 1:
usage()
else:
- print json.dumps(parse_tinc_stats())
-
+ print (json.dumps(parse_tinc_stats()))