From d931e6a9b64a42d0a946c741bf4fbd4b9c9f464b Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Mon, 14 Apr 2008 17:59:45 +0000 Subject: [PATCH 1/1] Add a field for the currently observed status as well as the PLC db configuration. --- nodegroups.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/nodegroups.py b/nodegroups.py index 92465d0..7ec1dde 100755 --- a/nodegroups.py +++ b/nodegroups.py @@ -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: -- 2.43.0