Add scripts to create myops-getqueryview:
[myops.git] / web / collect / server / txt2dict.py
1 #!/usr/bin/python
2
3 import sys
4
5 def file_to_dict(file):
6     convert = {
7         'iptables_status' : "list",
8         'rpm_versions' : "list",
9         'running_slices' : "list",
10     }
11     f = open(file, 'r')
12     d = {}
13     for line in f:
14         l = line[:-1]
15         s = l.split()
16         key = s[0]
17         val = " ".join(s[2:])
18         d[key] = val
19         if key in convert:
20             if convert[key] == "list":
21                 d[key] = d[key].split()
22     if 'type' not in d:
23         d['type'] = "node-status-v0"
24     return d
25
26