git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changes for 3.0
[monitor.git]
/
nodeconfig.py
diff --git
a/nodeconfig.py
b/nodeconfig.py
index
61d31f9
..
ac84ec3
100755
(executable)
--- a/
nodeconfig.py
+++ b/
nodeconfig.py
@@
-2,20
+2,28
@@
import plc
import plc
-import auth
-api = plc.PLC(auth.auth, auth.plc)
+api = plc.getAuthAPI()
-from optparse import OptionParser
+import parser as parsermodule
from sets import Set
from nodecommon import *
import database
from sets import Set
from nodecommon import *
import database
+def network_config_to_str(net):
+
+ str = ""
+ static_keys = ['method', 'ip', 'gateway', 'network', 'broadcast', 'netmask', 'dns1', 'dns2', 'mac', 'is_primary']
+ for k in static_keys:
+ str += "%15s == %s\n" % (k, net[k])
+
+ return str
+
+
def main():
def main():
- from config import config
fb = database.dbLoad("findbad")
fb = database.dbLoad("findbad")
- parser =
Option
Parser()
+ parser =
parsermodule.get
Parser()
parser.set_defaults(nodelist=None,
list=False,
add=False,
parser.set_defaults(nodelist=None,
list=False,
add=False,
@@
-24,8
+32,8
@@
def main():
)
parser.add_option("", "--nodelist", dest="nodelist", metavar="list.txt",
help="Use all nodes in the given file for operation.")
)
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:
# COLLECT nodegroups, nodes and node lists
for node in config.args:
@@
-33,7
+41,7
@@
def main():
try:
n = api.GetNodes(node)[0]
#print n
try:
n = api.GetNodes(node)[0]
#print n
- net = api.Get
NodeNetworks(n['nodenetwork
_ids'])[0]
+ net = api.Get
Interfaces(n['interface
_ids'])[0]
#print net
node_keys = ['boot_state', 'key', 'last_updated', 'last_contact']
#print net
node_keys = ['boot_state', 'key', 'last_updated', 'last_contact']
@@
-43,15
+51,15
@@
def main():
else:
print "%15s == %s" % (k, n[k])
else:
print "%15s == %s" % (k, n[k])
- static_keys = ['method', 'ip', 'gateway', 'network', 'broadcast', 'netmask', 'dns1', 'dns2', 'mac', 'is_primary']
- for k in static_keys:
- print "%15s == %s" % (k, net[k])
+ print network_config_to_str(net)
#for k in net.keys():
# print k, "==" , net[k]
except:
print "Error with %s" % node
import traceback; print traceback.print_exc()
#for k in net.keys():
# print k, "==" , net[k]
except:
print "Error with %s" % node
import traceback; print traceback.print_exc()
+ from nodecommon import email_exception
+ email_exception()
pass
# commands:
pass
# commands: