From 219fab970c7fe455d3dd9bc48e909d96a234046b Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 10 Sep 2015 15:48:38 +0200 Subject: adv_graphgen: finish packaging --- retiolum/scripts/adv_graphgen/tinc_graphs/Availability.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'retiolum/scripts/adv_graphgen/tinc_graphs/Availability.py') diff --git a/retiolum/scripts/adv_graphgen/tinc_graphs/Availability.py b/retiolum/scripts/adv_graphgen/tinc_graphs/Availability.py index 42f28ef9..888335a7 100755 --- a/retiolum/scripts/adv_graphgen/tinc_graphs/Availability.py +++ b/retiolum/scripts/adv_graphgen/tinc_graphs/Availability.py @@ -1,11 +1,12 @@ #!/usr/bin/python +# TODO: Rewrite this shitty piece of software ... # -*- coding: utf8 -*- import sys,json,os """ TODO: Refactoring needed to pull the edges out of the node structures again, it should be easier to handle both structures""" -DUMP_FILE = os.environment.get("AVAILABILITY_FILE","tinc-availability.json") -hostpath=os.environment.get("TINC_HOSTPATH", "/etc/tinc/retiolum/hosts") +DUMP_FILE = os.environ.get("AVAILABILITY_FILE","tinc-availability.json") +hostpath=os.environ.get("TINC_HOSTPATH", "/etc/tinc/retiolum/hosts") def get_all_nodes(): return os.listdir(hostpath) @@ -16,12 +17,12 @@ def generate_stats(): import json jlines = [] try: - f = open(DUMP_FILE,'r') + f = open(DUMP_FILE,'r+') for line in f: jlines.append(json.loads(line)) f.close() except Exception as e: - print("Unable to open and parse Availability DB: {} (override with AVAILABILITY_FILE)".format(DUMP_FILE) + print("Unable to open and parse Availability DB: {} (override with AVAILABILITY_FILE)".format(DUMP_FILE)) sys.exit(1) all_nodes = {} -- cgit v1.2.3