Skip to content

Commit

Permalink
Add PasswordAuthentication=no to first ssh command in wait_for_ssh
Browse files Browse the repository at this point in the history
It now newly sporadically happens that GCE instance just after
creation requires SSH password authentication. We don't support
this scenario and the password prompt blocks our terminal so the
whole test dies. This is disabling the password authentication
leaving us only key authentication which should be always available.
  • Loading branch information
pdostal committed Aug 7, 2024
1 parent 496fedc commit d2e8371
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/publiccloud/ssh_config
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ StrictHostKeyChecking no
HostKeyAlgorithms +ssh-rsa
IdentityFile %SSH_KEY%
ControlPersist 86400
PasswordAuthentication no

3 changes: 2 additions & 1 deletion lib/publiccloud/instance.pm
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ sub wait_for_ssh {
script_run("ssh-keyscan $args{public_ip} | tee -a ~/.ssh/known_hosts");
while (($duration = time() - $start_time) < $args{timeout}) {
# timeout recalculated removing consumed time until now
$sysout = $self->ssh_script_output(cmd => 'sudo systemctl is-system-running',
# We don't support password authentication so it would just block the terminal
$sysout = $self->ssh_script_output(cmd => 'sudo systemctl is-system-running', ssh_opts => '-o PasswordAuthentication=no',
timeout => $args{timeout} - $duration, proceed_on_failure => 1, username => $args{username});
# result check
if ($sysout =~ m/initializing|starting/) { # still starting
Expand Down

0 comments on commit d2e8371

Please sign in to comment.