Add a field for the currently observed status as well as the PLC db
authorStephen Soltesz <soltesz@cs.princeton.edu>
Mon, 14 Apr 2008 17:59:45 +0000 (17:59 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Mon, 14 Apr 2008 17:59:45 +0000 (17:59 +0000)
configuration.

nodegroups.py

index 92465d0..7ec1dde 100755 (executable)
@@ -20,6 +20,15 @@ api = plc.PLC(auth.auth, auth.plc)
 from config import config
 from optparse import OptionParser
 
+import soltesz
+fb = soltesz.dbLoad("findbad")
+
+def get_current_state(fbnode):
+       state = fbnode['state']
+       l = state.lower()
+       if l == "debug": return 'dbg'
+       return l
+
 parser = OptionParser()
 parser.set_defaults(nodegroup="Alpha",
                                        node=None,
@@ -58,7 +67,11 @@ if config.list:
        i = 0
        for node in nodelist:
                print "%-2d" % i, 
-               print "%(hostname)-38s %(boot_state)5s %(key)s" % node
+               if node['hostname'] in fb['nodes']:
+                       node['current'] = get_current_state(fb['nodes'][node['hostname']]['values'])
+               else:
+                       node['current'] = 'none'
+               print "%(hostname)-38s %(boot_state)5s %(current)5s %(key)s" % node
                i += 1
 
 elif config.add: