Add scripts to create myops-getqueryview:
[myops.git] / web / collect / server / txt2dict.py
diff --git a/web/collect/server/txt2dict.py b/web/collect/server/txt2dict.py
new file mode 100644 (file)
index 0000000..7a1a7d3
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+import sys
+
+def file_to_dict(file):
+    convert = {
+        'iptables_status' : "list",
+        'rpm_versions' : "list",
+        'running_slices' : "list",
+    }
+    f = open(file, 'r')
+    d = {}
+    for line in f:
+        l = line[:-1]
+        s = l.split()
+        key = s[0]
+        val = " ".join(s[2:])
+        d[key] = val
+        if key in convert:
+            if convert[key] == "list":
+                d[key] = d[key].split()
+    if 'type' not in d:
+        d['type'] = "node-status-v0"
+    return d
+
+