X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=getsshkeys.py;h=95df2e697800a6c200e832857bbfd61268a3f002;hb=4340c146173732c090d03d4496769fbc89bb986a;hp=fc306e4f829e3c109d0078ebff9296c20bee2f87;hpb=f38420ff4bc9fb114db5f62b01cc8990dc0a0af2;p=monitor.git diff --git a/getsshkeys.py b/getsshkeys.py index fc306e4..95df2e6 100755 --- a/getsshkeys.py +++ b/getsshkeys.py @@ -5,17 +5,25 @@ import sys import string import time import xml, xmlrpclib +try: + import monitorconfig + auth = {'Username' : monitorconfig.API_AUTH_USER, + 'AuthMethod' : "password", + 'AuthString' : monitorconfig.API_AUTH_PASSWORD} +except: + import traceback + print traceback.print_exc() + auth = {'AuthMethod' : "anonymous"} args = {} args['known_hosts'] = os.environ['HOME'] + os.sep + ".ssh" + os.sep + "known_hosts" -args['XMLRPC_SERVER'] = 'https://www.planet-lab.org/PLCAPI/' +args['XMLRPC_SERVER'] = 'https://boot.planet-lab.org/PLCAPI/' class SSHKnownHosts: def __init__(self, args = args): self.args = args self.read_knownhosts() - self.auth = {} - self.auth['AuthMethod'] = "anonymous" + self.auth = auth self.api = xmlrpclib.Server(args['XMLRPC_SERVER'], verbose=False, allow_none=True) self.nodenetworks = {} @@ -154,7 +162,7 @@ class SSHKnownHosts: key = key.strip() # TODO: check for '==' at end of key. - if key[-1] != '=': + if len(key) > 0 and key[-1] != '=': print "Host with corrupt key! for %s %s" % (node['boot_state'], node['hostname']) s_date = time.strftime("%Y/%m/%d_%H:%M:%S",time.gmtime(time.time()))