summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen/tinc_stats/Services.py
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2014-08-12 16:48:43 +0200
committermakefu <github@syntax-fehler.de>2014-08-12 16:48:43 +0200
commitf7174934c031e6aa547fbc565b4898fc58c8d5df (patch)
treeb7472fa644237276e598fbd5e89ee6c35d18074a /retiolum/scripts/adv_graphgen/tinc_stats/Services.py
parentbed9bcd8c0217a9f3e80ee99e396ae778c2328d6 (diff)
tinc_stats: add Services description to graph
Diffstat (limited to 'retiolum/scripts/adv_graphgen/tinc_stats/Services.py')
-rw-r--r--retiolum/scripts/adv_graphgen/tinc_stats/Services.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Services.py b/retiolum/scripts/adv_graphgen/tinc_stats/Services.py
new file mode 100644
index 00000000..6752e116
--- /dev/null
+++ b/retiolum/scripts/adv_graphgen/tinc_stats/Services.py
@@ -0,0 +1,17 @@
+services_dir="/home/makefu/r/services"
+def add_services(nodes):
+ for k,v in nodes.items():
+ n = nodes[k]
+ try:
+ with open("{0}/{1}".format(services_dir,k)) as f:
+ n["services"] = []
+ for line in f.readlines():
+ n["services"].append(line.strip())
+ except Exception as e:
+ n["services"] = ["Error: No Service File!"]
+ return nodes
+if __name__ == "__main__":
+ import json,sys
+ nodes = add_services(json.load(sys.stdin))
+ print (json.dumps(nodes,indent=4))
+# vim: set expandtab:ts=4:sw=4