X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=nodeconfig.py;h=ac84ec338f68cf021d0949bdcd10ab2f61fc1330;hb=refs%2Fheads%2F1.0;hp=d8a8c1247c5eee0c8166c1e7f160e940fc0b166e;hpb=c51ad794e8dc07072d705b508e79ba06849aa408;p=monitor.git diff --git a/nodeconfig.py b/nodeconfig.py index d8a8c12..ac84ec3 100755 --- a/nodeconfig.py +++ b/nodeconfig.py @@ -4,7 +4,7 @@ import plc api = plc.getAuthAPI() -from optparse import OptionParser +import parser as parsermodule from sets import Set from nodecommon import * @@ -21,10 +21,9 @@ def network_config_to_str(net): def main(): - from config import config fb = database.dbLoad("findbad") - parser = OptionParser() + parser = parsermodule.getParser() parser.set_defaults(nodelist=None, list=False, add=False, @@ -33,8 +32,8 @@ def main(): ) parser.add_option("", "--nodelist", dest="nodelist", metavar="list.txt", help="Use all nodes in the given file for operation.") - config = config(parser) - config.parse_args() + parser = parsermodule.getParser(['defaults'], parser) + config = parsermodule.parse_args(parser) # COLLECT nodegroups, nodes and node lists for node in config.args: @@ -42,7 +41,7 @@ def main(): try: n = api.GetNodes(node)[0] #print n - net = api.GetNodeNetworks(n['nodenetwork_ids'])[0] + net = api.GetInterfaces(n['interface_ids'])[0] #print net node_keys = ['boot_state', 'key', 'last_updated', 'last_contact'] @@ -59,6 +58,8 @@ def main(): except: print "Error with %s" % node import traceback; print traceback.print_exc() + from nodecommon import email_exception + email_exception() pass # commands: