|
|
@ -68,10 +68,10 @@ export const createHostConnection: RequestHandler< |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
localIPAddress = sub('find_matching_ip', { |
|
|
|
[localIPAddress] = await sub('find_matching_ip', { |
|
|
|
subModuleName: 'System', |
|
|
|
params: [{ host: peerIPAddress }], |
|
|
|
subParams: { host: peerIPAddress }, |
|
|
|
pre: ['System'], |
|
|
|
}).stdout; |
|
|
|
}); |
|
|
|
} catch (subError) { |
|
|
|
} catch (subError) { |
|
|
|
stderr(`Failed to get matching IP address; CAUSE: ${subError}`); |
|
|
|
stderr(`Failed to get matching IP address; CAUSE: ${subError}`); |
|
|
|
|
|
|
|
|
|
|
@ -89,15 +89,17 @@ export const createHostConnection: RequestHandler< |
|
|
|
stdoutVar({ pgpassFilePath, pgpassFileBody }); |
|
|
|
stdoutVar({ pgpassFilePath, pgpassFileBody }); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
sub('write_file', { |
|
|
|
await sub('write_file', { |
|
|
|
subModuleName: 'Storage', |
|
|
|
params: [ |
|
|
|
subParams: { |
|
|
|
{ |
|
|
|
body: pgpassFileBody, |
|
|
|
body: pgpassFileBody, |
|
|
|
file: pgpassFilePath, |
|
|
|
file: pgpassFilePath, |
|
|
|
mode: '0600', |
|
|
|
mode: '0600', |
|
|
|
overwrite: 1, |
|
|
|
overwrite: 1, |
|
|
|
secure: 1, |
|
|
|
secure: 1, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
pre: ['Storage'], |
|
|
|
}); |
|
|
|
}); |
|
|
|
} catch (subError) { |
|
|
|
} catch (subError) { |
|
|
|
stderr(`Failed to write ${pgpassFilePath}; CAUSE: ${subError}`); |
|
|
|
stderr(`Failed to write ${pgpassFilePath}; CAUSE: ${subError}`); |
|
|
@ -106,12 +108,15 @@ export const createHostConnection: RequestHandler< |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
const [rawIsPeerDBReachable] = sub('call', { |
|
|
|
const [rawIsPeerDBReachable]: [output: string, returnCode: number] = |
|
|
|
subModuleName: 'System', |
|
|
|
await sub('call', { |
|
|
|
subParams: { |
|
|
|
params: [ |
|
|
|
shell_call: `PGPASSFILE="${pgpassFilePath}" ${SERVER_PATHS.usr.bin.psql.self} --host ${peerIPAddress} --port ${commonDBPort} --dbname ${commonDBName} --username ${commonDBUser} --no-password --tuples-only --no-align --command "SELECT 1"`, |
|
|
|
{ |
|
|
|
}, |
|
|
|
shell_call: `PGPASSFILE="${pgpassFilePath}" ${SERVER_PATHS.usr.bin.psql.self} --host ${peerIPAddress} --port ${commonDBPort} --dbname ${commonDBName} --username ${commonDBUser} --no-password --tuples-only --no-align --command "SELECT 1"`, |
|
|
|
}).stdout as [output: string, returnCode: number]; |
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
pre: ['System'], |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
isPeerDBReachable = rawIsPeerDBReachable === '1'; |
|
|
|
isPeerDBReachable = rawIsPeerDBReachable === '1'; |
|
|
|
} catch (subError) { |
|
|
|
} catch (subError) { |
|
|
|