Debian Codegraph @

tests/functional/intelligent-host-selection/01-periodic-clear-badhosts/bin/mock-ssh

raw
1 #!/usr/bin/env bash
2
3 shift # the first argument to SSH is the host we are connecting to (ignore it)
4
5 COUNT_FILE="$(dirname "$0")/count"
6
7 echo 'x' >> "$COUNT_FILE"
8
9 if [[ $(wc -l "$COUNT_FILE" | cut -d ' ' -f 1) -eq 1 ]]; then
10 # the first time we make it look like an SSH failure
11 exit 255
12 else
13 # from then on we make it look like SSH is working fine
14
15 # do the bare minimum to make it look like remote-init worked
16 echo 'KEYSTARTxxxxKEYEND'
17 echo 'REMOTE INIT DONE'
18 exit 0
19 fi