summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen/tinc_stats/Services.py
diff options
context:
space:
mode:
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