Force update known hosts every time
parent
c433fca575
commit
2ff767fc30
File diff suppressed because one or more lines are too long
|
@ -18,10 +18,7 @@ const run = async () => {
|
||||||
// Add SSH key
|
// Add SSH key
|
||||||
addSshKey(sshPrivateKey, deployKeyName);
|
addSshKey(sshPrivateKey, deployKeyName);
|
||||||
const { path: privateKeyPath } = getPrivateKeyPath(deployKeyName);
|
const { path: privateKeyPath } = getPrivateKeyPath(deployKeyName);
|
||||||
// Update known hosts if ssh command is present to avoid prompt
|
updateKnownHosts(remoteHost, remotePort);
|
||||||
if (scriptBefore || scriptAfter) {
|
|
||||||
updateKnownHosts(remoteHost, remotePort);
|
|
||||||
}
|
|
||||||
// Check Script before
|
// Check Script before
|
||||||
if (scriptBefore) {
|
if (scriptBefore) {
|
||||||
await remoteCmdBefore(scriptBefore, privateKeyPath);
|
await remoteCmdBefore(scriptBefore, privateKeyPath);
|
||||||
|
|
|
@ -19,7 +19,7 @@ const addSshKey = (content, deployKeyName) => {
|
||||||
const { dir, filename } = getPrivateKeyPath(deployKeyName);
|
const { dir, filename } = getPrivateKeyPath(deployKeyName);
|
||||||
writeToFile({ dir, filename: KNOWN_HOSTS, content: '' });
|
writeToFile({ dir, filename: KNOWN_HOSTS, content: '' });
|
||||||
console.log('✅ [SSH] known_hosts file ensured', dir);
|
console.log('✅ [SSH] known_hosts file ensured', dir);
|
||||||
writeToFile({ dir, filename, content: `${content.replace(/\r\n/g, "\n")}\n`, isRequired: true, mode: '0400' });
|
writeToFile({ dir, filename, content: `${content.replace(/\r\n/g, '\n')}\n`, isRequired: true, mode: '0400' });
|
||||||
console.log('✅ [SSH] key added to `.ssh` dir ', dir, filename);
|
console.log('✅ [SSH] key added to `.ssh` dir ', dir, filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue