Commit d07f5a2a authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix

parent c262dc51
...@@ -105,3 +105,5 @@ dist ...@@ -105,3 +105,5 @@ dist
# Stores VSCode versions used for testing VSCode extensions # Stores VSCode versions used for testing VSCode extensions
.vscode-test .vscode-test
/data/
/result/
...@@ -16,14 +16,26 @@ async function main() { ...@@ -16,14 +16,26 @@ async function main() {
return fs.promises.writeFile('result/inventory.yaml', result); return fs.promises.writeFile('result/inventory.yaml', result);
} }
function host_vars(host, hosts, connections: string[]) { function host_vars(host, hosts, hostNames: string[]) {
const connections = [];
for (const h of hostNames) {
if (h != host.name) {
const peer = host[h] || hosts[h][host.name];
if (peer) {
connections.push(parse_connection(h, peer));
}
}
}
return { return {
ansible_ssh_user: host.user, ansible_ssh_user: host.user,
address: host.address, address: host.address,
connections: connections.filter(h => h != host.name).map(h => parse_connection(h, host[h] || hosts[h][host.name])) connections
}; };
} }
function connections() {}
function parse_connection(name: string, str: string) { function parse_connection(name: string, str: string) {
const [_metric, protocol, _params] = str.split(','); const [_metric, protocol, _params] = str.split(',');
const metric = parseInt(_metric); const metric = parseInt(_metric);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment