- add check script from Sergey Scobich (#246102)
authorKarsten Hopp <karsten@redhat.com>
Thu, 5 Jun 2008 12:17:12 +0000 (14:17 +0200)
committerKarsten Hopp <karsten@redhat.com>
Thu, 5 Jun 2008 12:17:12 +0000 (14:17 +0200)
check_monitorsdb.py [new file with mode: 0755]

diff --git a/check_monitorsdb.py b/check_monitorsdb.py
new file mode 100755 (executable)
index 0000000..72c19f9
--- /dev/null
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+f = open("MonitorsDB", "r")
+out = open("MonitorsDBOut", "w")
+
+monIds = dict()
+
+for line in f.readlines():
+    if len(line.strip()) and not line.strip().startswith('#'):
+        values = map(lambda x: x.strip(), line.split(';'))
+        if len(values) < 5:
+            print "This line contains two few values\n%s" % line
+        manufacturer = values[0]
+        model = values[1]
+        monId = values[2]
+        vGh = values[3]
+        hGh = values[4]
+        if len(manufacturer) == 0:
+            print "This line doesn't contain Manufacturer\t%s" % line
+            continue
+        if len(model) == 0:
+            print "This line contains empty model\t%s" % line
+            continue
+        if len(monId) == 0 or monId == "0":
+            print "This line contains empty monitor Id\n%s" % line
+            continue
+        if len(vGh) == 0 or len(hGh) == 0:
+            print "This line contains wrong Gh\t%s" % line
+            continue
+        if monIds.has_key(monId):
+            print "Two line have the same monitor Ids\n%s%s" % (monIds[monId], line)
+            continue
+        else:
+            monIds[monId] = line
+    out.write(line)
+f.close()
+out.close()
+