fix: ensure the known_hosts file exists before attempting to ssh onto a server
This commit is contained in:
1 parent
1e559f20e5
commit
56f25c4855
1 file changed
+4
@@ -254,6 +254,10 @@ func (task SshTask) Execute(ctx context.Context) (SshResult, error) {
|
|||||||
return SshResult{}, fmt.Errorf("failed to load known hosts: %w", err)
|
return SshResult{}, fmt.Errorf("failed to load known hosts: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := TouchFile(filepath.Join(os.Getenv("DOKKU_ROOT"), ".ssh", "known_hosts")); err != nil {
|
||||||
|
return SshResult{}, fmt.Errorf("failed to touch known_hosts file: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
if task.AllowUknownHosts {
|
if task.AllowUknownHosts {
|
||||||
callback = ssh.InsecureIgnoreHostKey()
|
callback = ssh.InsecureIgnoreHostKey()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user