- type: javascript
name: resolve_replica_hostnames
script: |
const ipsRaw = replica_ip_list.stdout.trim();
if (!ipsRaw) {
fail("❌ No replica IPs found.");
}
const ipList = ipsRaw.split(/\s+/); // split by whitespace
const hostnameMap = {};
let pendingLookups = ipList.length;
for (const ip of ipList) {
Amelia.host.resolveHostname(ip, function(result) {
if (result.error) {
hostnameMap[ip] = "⚠️ Lookup failed";
} else {
hostnameMap[ip] = result.hostname;
}
pendingLookups--;
if (pendingLookups === 0) {
const summary = ipList.map(ip => `${ip} → ${hostnameMap[ip]}`).join("\n");
proceed({
message: `🔍 Resolved Hostnames:\n${summary}`,
replica_hosts: hostnameMap
});
}
});
}





0 comments:
Post a Comment