latest addition of /var/lib/ for current and archived data files
[monitor.git] / nodegroups.py
index 20f1513..207efae 100755 (executable)
@@ -22,11 +22,11 @@ from sets import Set
 from nodequery import verify,query_to_dict,node_select
 
 from nodecommon import *
-import soltesz
+import database
 
 def main():
        from config import config
-       fb = soltesz.dbLoad("findbad")
+       fb = database.dbLoad("findbad")
 
        parser = OptionParser()
        parser.set_defaults(nodegroup="Alpha",
@@ -119,15 +119,8 @@ def main():
        hostnames = [ n['hostname'] for n in nodelist ]
 
        # commands:
-       if config.list:
-               print " ---- Nodes in the %s Node Group ----" % group_str
-               i = 1
-               for node in nodelist:
-                       print "%-2d" % i, 
-                       print nodegroup_display(node, fb, config)
-                       i += 1
 
-       elif config.add and config.nodegroup:
+       if config.add and config.nodegroup:
                for node in hostnames:
                        print "Adding %s to %s nodegroup" % (node, config.nodegroup)
                        api.AddNodeToNodeGroup(node, config.nodegroup)
@@ -137,6 +130,14 @@ def main():
                        print "Deleting %s from %s nodegroup" % (node, config.nodegroup)
                        api.DeleteNodeFromNodeGroup(node, config.nodegroup)
 
+       elif config.list:
+               print " ---- Nodes in the %s Node Group ----" % group_str
+               i = 1
+               for node in nodelist:
+                       print "%-2d" % i, 
+                       print nodegroup_display(node, fb, config)
+                       i += 1
+
        else:
                print "no other options supported."