X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=getsshkeys.py;h=7b747596678b2b87cf1ac5e79bbb508cea4620ee;hb=16b7bc48471b0695e72320fbcf761db695af032e;hp=68d29452d1a97bd95dabc0e31312a0e53edaeb75;hpb=4d56ef5473c6486c321dd2797be45b45b0606dae;p=monitor.git diff --git a/getsshkeys.py b/getsshkeys.py index 68d2945..7b74759 100755 --- a/getsshkeys.py +++ b/getsshkeys.py @@ -18,7 +18,7 @@ except: args = {} args['known_hosts'] = os.environ['HOME'] + os.sep + ".ssh" + os.sep + "known_hosts" try: - import config + from monitor import config args['XMLRPC_SERVER'] = config.API_SERVER except: args['XMLRPC_SERVER'] = 'https://boot.planet-lab.org/PLCAPI/' @@ -135,15 +135,15 @@ class SSHKnownHosts: if type(host) == type(""): host = [host] # get the node(s) info - nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","nodenetwork_ids"]) + nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","interface_ids"]) # for each node's node network, update the self.nodenetworks cache nodenetworks = [] for node in nodes: - for net in node["nodenetwork_ids"]: + for net in node["interface_ids"]: nodenetworks.append(net) - plcnodenetworks = self.api.GetNodeNetworks(self.auth,nodenetworks,["nodenetwork_id","ip"]) + plcnodenetworks = self.api.GetInterfaces(self.auth,nodenetworks,["nodenetwork_id","ip"]) for n in plcnodenetworks: self.nodenetworks[n["nodenetwork_id"]]=n return nodes @@ -152,10 +152,10 @@ class SSHKnownHosts: host = node['hostname'] key = node['ssh_rsa_key'] - nodenetworks = node['nodenetwork_ids'] + nodenetworks = node['interface_ids'] if len(nodenetworks)==0: return (host, None, None, None) - # the [0] subscript to node['nodenetwork_ids'] means + # the [0] subscript to node['interface_ids'] means # that this function wont work with multihomed nodes l_nw = self.nodenetworks.get(nodenetworks[0],None) if l_nw is None: return (host, None, None, None)