- node = plc.getNodes(host)
- ret = self._record_from_node(node[0])
- (host, ip, key, comment) = ret
- if ip == None:
- self.updateDirect(host)
- else:
- rec = { "%s,%s" % (host,ip) : "%s %s" % (key, comment) }
- self.pl_keys.update(rec)
+ node = self.delete(host)
+ #node = self.getNodes(host)
+ if node is not []:
+ ret = self._record_from_node(node[0])
+ (host, ip, key, comment) = ret
+ if ip == None:
+ self.updateDirect(host)
+ else:
+ rec = { "%s,%s" % (host,ip) : "%s %s" % (key, comment) }
+ self.pl_keys.update(rec)
+
+ def getNodes(self, host=None):
+ if type(host) == type(""): host = [host]
+
+ # get the node(s) info
+ nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","nodenetwork_ids"])
+
+ # for each node's node network, update the self.nodenetworks cache
+ nodenetworks = []
+ for node in nodes:
+ for net in node["nodenetwork_ids"]:
+ nodenetworks.append(net)
+
+ plcnodenetworks = self.api.GetNodeNetworks(self.auth,nodenetworks,["nodenetwork_id","ip"])
+ for n in plcnodenetworks:
+ self.nodenetworks[n["nodenetwork_id"]]=n
+ return nodes