Force update known hosts every time
This commit is contained in:
		
							parent
							
								
									c433fca575
								
							
						
					
					
						commit
						2ff767fc30
					
				
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -18,10 +18,7 @@ const run = async () => {
 | 
			
		||||
  // Add SSH key
 | 
			
		||||
  addSshKey(sshPrivateKey, deployKeyName);
 | 
			
		||||
  const { path: privateKeyPath } = getPrivateKeyPath(deployKeyName);
 | 
			
		||||
  // Update known hosts if ssh command is present to avoid prompt
 | 
			
		||||
  if (scriptBefore || scriptAfter) {
 | 
			
		||||
    updateKnownHosts(remoteHost, remotePort);
 | 
			
		||||
  }
 | 
			
		||||
  updateKnownHosts(remoteHost, remotePort);
 | 
			
		||||
  // Check Script before
 | 
			
		||||
  if (scriptBefore) {
 | 
			
		||||
    await remoteCmdBefore(scriptBefore, privateKeyPath);
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ const addSshKey = (content, deployKeyName) => {
 | 
			
		||||
  const { dir, filename } = getPrivateKeyPath(deployKeyName);
 | 
			
		||||
  writeToFile({ dir, filename: KNOWN_HOSTS, content: '' });
 | 
			
		||||
  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);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user