Fix race where password was printed on screen

This commit is contained in:
Patrik Holmqvist 2025-01-17 09:31:33 +01:00
parent 37ae0c2d7b
commit c4efcfec0a
Signed by: pahol
GPG key ID: 5D5B0D4E93F77273
2 changed files with 11 additions and 4 deletions

View file

@ -8,8 +8,12 @@ spawn dsmc restore /opt/backup-test/ /opt/restore-target/ -asnodename=$nodename
expect "Action \\\[1,2,3,A\\\] : " {
send -- "1\r"
expect -exact "Enter encryption key password: "
# Some times the password shows up in the output,
# we suspect this is a race condition with turning of echo for the tty, so sleep
sleep 1
send -- "$enc_password\r"
expect -exact "Confirm encryption key password: "
sleep 1
send -- "$enc_password\r"
}
expect "ANS8013I Invalid encryption key password" {

View file

@ -6,11 +6,14 @@ set exit_val 1
spawn dsmc restore /opt/backup-test/ /opt/restore-target/ -asnodename=$nodename -subdir=yes
expect "Action \\\[1,2,3,A\\\] : " {
send -- "1\r"
expect -exact "Enter encryption key password: " {
send -- "1\r"
expect -exact "Enter encryption key password: "
# Sometimes the password shows up in the output,
# we suspect this is a race condition with turning of echo for the tty, so sleep
sleep 1
send -- "$enc_password\r"
}
expect -exact "Confirm encryption key password: " {
expect -exact "Confirm encryption key password: "
sleep 1
send -- "$enc_password\r"
}
expect "Restore processing finished." {